Connect to SOAP using Java NetBeans - java

I can successfully connect to a SOAP service using SOAP UI.
However, I cannot find a good guide on connecting to the SOAP service using Java NetBeans where I need to pass username+password to SOAP, can someone suggest a good tutorial/guide for this purpose?
My example below that works with SOAP UI, but doesn't work correctly when I try to use Java like JAX WS...
See the SOAP UI screenshot here from dropbox: https://www.dropbox.com/s/3iwrees1ph36j0k/soap.png?dl=0
or Drive: https://drive.google.com/file/d/0B6qlCIai7vD3X05LMVA2YUo1ejQ/view?usp=sharing

Related

Building REST Java API on existing PHP server

In a recent academic project I need to create some REST Java API (web service) that works on an existing PHP server.
I don't have much clear ideas on how to implement it. How would you implement the logic? Is it okay to send a request (Ajax) to the web service, which it then forwards it to the PHP server?
How would you implement it?
Thank you for your advises!
Java REST service could call PHP REST service. If REST service on php side not implemented, we can use some html robot for acting like a http client from java. HtmlUnit or Selenium for example.

implementing a SOAP web service with a wrong wsdl

I am trying to implement a soap ws client in my java application. I have a WSDL file to generate the client stubs. When I implemented the code, I saw that the WSDL file is out of date and I can not get the response as expected in the WSDL. I do not have an option to make the vendor update WSDL.
What are my options to implement the client properly?
Is it possible to fix the WSDL manually or intercept the response before generated codes receive the response?
Thank you.
You can always get the most updated WSDL by accessing the URL from the browser. Since you are able to communicate with the server application I assume you have the server application endpoint.
The URL should be simller to the folliwng
http[s]://(IP or Domain Name)[:port]/.../...?WSDL
Here is an example for a common WSDL online for global weather as an example of how WSDL URL look like
http://www.webservicex.net/globalweather.asmx?WSDL
Additional Details:
You can re-generate the stub classes from WSDL URL directly using many tools like:
Axis
Code Generator Wizard Guide for Eclipse Plug-in
Code Generator Tool Guide for Command Line and Ant Task
Apache CXF
Generate a JAX-WS Web Service Client from a WSDL document using Apache CXF

Creating a client for a existing web service out of a WSDL file with Java

I have a given WSDL file (a SOAP web service in the internet) and I want to use this service. For that I want to write a Java client, that sends the required datas (as XML) to the web service and the service itself sends an response.
Unfortunately, I am totaly new in web services. This is why I want you to ask for help.
I found a lot of ways to use SOAP in Java. One way is the AXIS2 framework from Apache, another way is the Eclipse Web Tools Project (WTP). I've tried both but couldn't get it run..
First of all.. What do I need to use such an SOAP web service?
I think:
- generate Java source out of the WSDL file
- write an client that uses this code
- with this client you can send datas to the web service (the client itself sends the data via XML) and the client can process the response
Am I right or do I have a fallacy?
Thank you for your help!!
I think: - generate Java source out of the WSDL file - write an client that uses this code - with this client you can send datas to the web service (the client itself sends the data via XML) and the client can process the response
That is correct. You can use Axis2 as you mentioned, write a JAX-WS client, you can even write the SOAP message by hand (not that I would recommend that though).
You should try to get a successful call from SoapUI first then write your client application. Use wsimport to get a simple client working (if that's all you need a framework like Axis2 could be overkill).

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

How to Consume SOAP 1.2 Web Service Created in WCF by a Java Client?

I'm developing a Web Service Project in which I have to implement a web service that should be interoperable on all platforms. So initially I used basicHttpBinding as it uses SOAP 1.1 but I want the features of WS-* like reliable messaging, security, exceptions. So I used wsHttpBinding which is a SOAP 1.2 standard.
Now after deploying on my test server I used Netbeans IDE to generate a webservice client. So in return it called the wsimport tool in java to generate proxy classes. When I invoke any method it simply goes into non-working state like there is no activity for 5 mins. So I'm not able to figure out that whether Java client can consume a SOAP 1.2 web service created in WCF?
I need to know if I need to use any other binding than wsHttpBinding for all the features and have interoperability as well.
I don't get any error when i invoke the web method.I tried debugging it but to no help.i set break-point on the line which was invoking the method,when debugger reaches that line then nothing happens, IDE shows running status but there is no activity.If anyone can suggest a tool to monitor Http request to server.
Have you tried tracing the communication between the Java client and the WCF service?
I would do two things first, turn on logging in WCF; use a trace tool (there are many tike tcptrace) to act as a proxy between the client and server, then point the client at the trace tool and the trace tool at the server. That way you get to see the traffic and the XML (if any) sent back and fore. That should give you a much better idea as to what is going on.
Why not configure another endpoint using SOAP 1.1?

Categories