Group WebMethods in WebService - java

I've got question because I didn't find any answer in all internet.
I'm using Wildfly 8.2.0 and JaxWS WebService by Netbeans 8.0.2, and i'm importing this WSDL output to VisualStudio as Service Reference. I know it's maybe not the best way to do WebAPI but but...
Everything's work great except that all WebMethods are in one place. I've got VisualStudio Client() and structure is Client().AllFunctionsHere.
Can I somehow group WebMethods which as result I will get Client().Login.Auth(), Client().Register.AddNew(), Client().Register.ComparePasswords() etc...
It's theoretically very valuable but I couldn't find solution.
P.S.: I don't want to create few WebServices because I've got "Login" method and a few WebServices don't share session unfortunatelly.

Related

Building Web-Service client from existing WSDL file using java

I've been tasked with building a web service in java, and I've been given an existing WSDL file which seems to define everything. I need to build my java around/using this (Not consuming it though) . How would I go about using this in eclipse?
I've tried going "New Web Service Client" and selecting the WSDL However the code it generates doesn't include any of the methods (which is just 1) or the parameters from the WSDL.
You can use Apache CXF WSDL to Java for doing this thing.Look at here Click here and also google it for more details
Also you can use SoapUi for doing this. I think soapUi way is more easy than the previous method click for soapUI tutorial
WSDL consist every detail about how your web service should look like and the functionality
I think if you're trying to write the web service using an existing WSDL, you're probably going about it the wrong way. It looks like from the command that it's trying to build you a client, not a server.
I had some luck with the WSDL-first tutorial in the Spring-WS library. I would take a look at that.
http://static.springsource.org/spring-ws/site/reference/html/tutorial.html

WebService in Java using NetBeans

guys!
I'm kinda new to WS, as well to Java, and i wondered if you could help me.
I gotta create a WS ( Don't tell me?! ;) ) and a need to deploy it to TomCat but, i "don't" know how to do it. My WS's are meant to do some access to SP's in a database and return the results.
Simple. Its already done. Used NetBeans, developed, published on my own PC and cretead a desktop application in C# and added the WSs reference. Works great.
The thing is: the people that im going to send my WS are in other State, far away from here. I wanted to know how to do it. I saw that i can right click on the webService (The WS it self, localized inside the WebService projects folder "Web Services" generated by NetBeans) and click on "Generate and copy WSDL", get this wsdl file, send to the people that i want and they put it inside the "WebApps" folder on their TomCat Server, and whoever accesses de server can see my services.
Is that correct? If not, how can i do it?
One more thing: i created a class in java to access the database, with the connection string. There is some kinda of ".config" that i can put these information in? I didn't find that on the WebService project i created...
Thanks for the patience!
Just sending WSDL will be not enough since that just defines the protocol and operations of the WS. It does not say anything about implementation. What you need to do is generate a web archive package (.war, think of it as a .jar for webapp) and send that to the customer that you are writing it for. They can then deploy it on to their server.

SoapUI vs Java Web Service Client

If a SOAP web service is working well via SoapUI (producing the correct SOAP responses), while building a web service client in Java using different APIs/frameworks to call this web service is facing different issues, is it safe to consider this web service stable and the issues are from the consumer side?
I'm asking a generic question in here, I have already asked a detailed one which is probably too long to read. I'm interested in the concept more than my actual implementation, so if you can answer my question without referring to my longer post, please do.
UPDATE:
I have realized that even if the WSDL is WS-I compliant and it's functioning correctly via SoapUI, this is still not enough to conclude that the web service is not broken. As #jtahlborn said, SoapUI is very tolerant to broken web services, and it could easily trick you to believe your web service is working fine, which is what happened in my case.
I'm constructing the SOAP response in the ESB and my issue was that I used a namespace that was defined in the WSDL but not in the schema. SoapUI received the response and showed it to me (with the wrong namespace); this issue could have been avoided if I turned on the response validation option.
It's also noteworthy to mention that in the Java web service client I created to test my web service, the response could not be loaded into the output object (a NullPointerException error showed up when I tried to access the output object), this was due to the namespace issue and it started working correctly once I fixed the namespace.
SoapUI is a fantastic product. one of the things which makes it a great product, however, is that it is very tolerant of poorly defined webservices. in our product, we deal with lots of webservices, and a frequent comment on an issue in our product is "it works fine in SoapUI". we have learned the hard way that SoapUI will tolerate all kinds of broken webservices. so, in summary, working with SoapUI is not a proof that your webservice is well-defined.
There are WS-I testing tools to check your web service for conformance to the Web Services Interoperability profiles. If your service adheres to the WS-I basic profile, and SoapUI can call it, the issues are definitely on the consumer side.
EDIT: well, or in between the both...
SoapUI can check your wsdl for WS-I compliance, see http://www.soapui.org/SOAP-and-WSDL/working-with-wsdls.html.
It's most likely that the consumer (client) is buggy... If the client is generated using wsdl2java it's a big chance to have bugs in it... and if you are using some special functionalities that are valid (conforming w3c) then don't be surprised... the generated clients sometimes do this... even some libraries used to generate java classes or libraries to generate the webservices are full of bugs...
A lot of things are not supported by known and frequently used libraries... (I don't want to give names -- but wsdl4java is not perfect)..
If you are using security or something ... higher chances to have bugs on both server and client side :)
maybe if you tell us what is the problem we can help you...

How to query a SOAP Service in Java

I would like to connect and query Trip Advisor's SOAP service. I currently have a WSDL for the service, and have connected to it using SOAPUI. I have been doing a lot of research about SOAP, but still am not sure I fully understand what I need to code in order to query the service as I would like.
The service takes an input of a simple place-id(I Have a list of many place-ids that I would like to query) Then it returns with the SOAP reply, which I would like to save as a new file(named place-id.SOAPrequest).
I have been doing reading on AXIS2, how to generate API code using SOAPUI, and launching a SOAP service in Netbeans.
I am currently trying to launch a AXIS2 service on my server, and then I assume load into it the java code that SOAPUI generating for the wsdl. But I don't know how to do this or if this is even the correct approch to the problem. Any suggestions or advice would be great.
See this step by step guide to Generate Java Axis 2 WebService CLIENT/SERVER

Switching between .Net Webservice and Java Webservice by changing URL

Here is the situation. I have received a WSDL (and included XSD) from someone that is generated by an Apache/Tomcat server (Java). The company i do a project for, prefers .NET so i used wsdl.exe to generate a partial class and created the webservice.
Then I created a .NET client (in this case I am using VB.NET) that has a web reference to the java wsdl. This works fine. Then I change the url using code and make it point to my newly created .NET service but i cannot seem to get it to work.
Doing it the other way round, also doesnt seem to work.
Been fiddling a bit with the namespaces and the service name but can't seem to crack it. Keeps giving me an error about HTTP header unable to find . as a method. This indicates a transport problem.
I really do not want to revert to plan B, being the creation of a Java Webservice and then linking this to the .NET environment. I know this will work since you will never have to change the urls.
Any suggestions ?
So to summarise you have:
SERVER SIDE: java, WSDL: java generated
.NET client -> java server - WORKS .NET client -> .NET server -> FAILS
If thats the case this has not much to do with Java!
But I do know as I aluded to earlier that .NET servers are fussy about the soap action header.
Is there a soapAction in your WSDL?
If so, you need to send that value, but I don't know how to do this in .NET (Google would be your friend here).
If not, check out the comments in this question for how to determine the required soap action header value: stackoverflow.com/questions/2262781/soap-action-wsdl
After a bit of searching through the devine knowledge base (Google), i have managed to get this fixed.
In addition to being very carefull in specifying the portnames (the default ones are not always what is requested so you need to override it) but most importantly, i found that adding
as part of the asm class header solved my problem. Now all I need to do is find out why?
But trust me, it works...
I found the solution here

Categories