I'm new to web services and I've been breaking my head trying to find a simple java SOAP client program on the Internet.
All I want to do is send a SOAP message and receive back some response.
There is a website which offers free web-services.
http://www.webservicex.net/ws/WSDetails.aspx?WSID=17&CATID=7
You feed in the country name and it gives you the country's ISD code. It's as simple as that.
I want to send the country name to the web service and get back its ISD code using only Javaand without any external jars.
Try SoapUI - it's quite awesome and covers almost all aspects of working w/ web-services..
If you're looking for a tool to test web-services, most people I know use Soap-UI: http://www.soapui.org/
Related
So, here's my challenge: I have to build a webservice which handles payments using PayPal... The SOAP way! Since I'm a Node developer I'm very familiar with REST but the challenge is that I have to build it with Java, XML-schemas and SOAP using the Spring-framework.
Now I found this workflow when using REST: https://devtools-paypal.com/guide/pay_paypal/java?interactive=ON&env=sandbox.
That looks easy as pie to me! But what would this workflow look like when using SOAP and how would you implement this. As in: How do you handle redirects and responseURLs? Or is the workflow different?
P.S. I know PayPal has lots and lots of documentation but when it comes to SOAP, I just can't figure out the workflow or how to handle responseURLs..
Thnx in advance!
I'm going to assume you want to implement Express Checkout.
The flow is basically the same, different endpoints, but same steps. You can see the workflow here:
https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/
Just reference the diagram. Everything below isn't specific to SOAP.
In brief, the flow looks like this:
1: Call SetExpressCheckout to get back a token.
2: Redirect to PayPal using token obtained in step 1.
3. If user accepts checkout then call GetExpressCheckoutDetails to get transaction details.
4. Use Token and PayerID (obtained in step 3) in call to DoExpressCheckoutPayment to capture payment.
Here's a good place to start: https://developer.paypal.com/docs/classic/api/#ec
The first snag I ran into when implementing the SOAP API versus the REST API was that I couldn't find anywhere in the documentation where to find the redirect URL. The REST API will send it back, the SOAP does not. I had to dig through some of the SDK files to find it.
Redirect to here: https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=
I want to run the following web service.I will give two parameters and this web service simply
returns these parameters back to me.
http://soapclient.com/xml/soapresponder.wsdl
I want to generate a client program using this service (create client with apache-cxf), two text box,
sending parameters and a result textbox, showing the response. Problem is i dont know how doing these things on java.Before i interested on .Net c#. I want to develop myself but no more documents on this topic in my own country.
I am learning to make web services with eclipse, apache and axis 2 following this tutorial. I am able to generate web services, create and upload .aar files and generate web service clients just like in the tutorial. But when I go to test the client it is not generating proper responses...
PersonalInfoServiceStub stub = new PersonalInfoServiceStub();
GetContactInfo atn = new GetContactInfo();
atn.setPersonID(1);
GetContactInfoResponse c = stub.getContactInfo(atn);
System.out.println(c.get_return()); //returns null
// The Java Class that serves as the basis for the web service works well...
PersonalInfoService s = new PersonalInfoService();
System.out.println(s.getContactInfo(1).getStreet()); //returns main street
This is all very new for me (I am still pretty dependent on following the tutorial) so I am not sure what might be causing this issue or how I might go about debugging what's wrong. What might be causing the problem and how would I go about debugging it?
If I try to call the webservice in the broswer using this url:
http://localhost:8080/axis2/services/PersonalInfoService/getContactInfo?personID=1
I get this
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<ns:getContactInfoResponse xmlns:ns="http://webservices.com">
<ns:return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</ns:getContactInfoResponse>
It looks like your client code is okay. The response from the server just doesn't contain any data. The simplest explanation is that the server sent back a response without any data. If I were you, I'd troubleshoot the server's behavior when it receives this request, rather than focusing on the client code.
I would start with Wireshark or tcpdump, this will help you capturing Network traffic that will help you debug at application and transport level what your Java code is generating and the response from server.
I am working on an application, that will pass client input to a vendor using web services. As phase I of the project, the vendor provided us with the XSD's and WSDL information. I used apache CXF to build the client jar. Now the issue I am facing is that, as part of the requirement, I need to send them the SOAP Request in an encrypted(I have taken care of the encryption part) XML file, that they will manually process, and send me back the response in another XML file that I need to parse and retrieve the response object.
Is there anyway to use the client jar in a dummy mode or something, where it looks like we are calling the client, but all we are doing is getting the raw SOAP request to a file
I kind of a hit a dead end and I am not totally sure how to proceed here, any help or suggestions would be appreciated
You might try SoapUI, it's a free web service testing tool. I know you can view the raw data of your soap request and response with it. soapUI
So what I need is basically to create a java program that runs from command line and will continue to run until I decide to stop it. The goal of this program is to read email from a particular email address and create JIRA tickets using the contents of the email.
IE: subject of email will be title. Body will be description. Etc...
I am getting confused with how to go about with the design of how to do this. I know I can use JavaMail to gain access to the emails right? Then I just have to parse the email. But other than that I am a little stuck on how I should be making the JIRA Ticket
Thanks!
Your problem is an ideal use case for esb like mule or spring-integration. Basically these eip frameworks provide all building blocks you just need to connect.
First you need to define mail inbound. This component will automatically connect to an mail inbox and fetch all new messages.
Then define a transformation from e-mail message to json object. Finally POST that object using HTTP outbound. You can create ticket in JIRA using /rest/api/2/issue API method.
whole workflow can be implemented almost without coding. Of course you can do everything manually (using javamail and httpclient), but then threading, error handling and retrying is up to you.
For the future - if you're confused what requests are sent and so on - use Google Chrome.
Press Ctrl+Shift+I->Network and make request. If you need to login before etc. it is the same.
For handling HTTP requests (POST, GET, etc.) I recommend to use HttpClient or if you need to use JavaScript HtmlUnit.
So answer is this:
- Track what requests are made when you do certain things via web browser
- implements the same in Java code using HttpClient or HtmlUnit