I have created a web service in Ab-initio, I want to call that web service from java, I have read a lot information from help file. It gives me some information about plugin, but they have not mentioned it specifically that how to call service mentioned in plugin from java. Will anyone please guide me through it.
Thank in advance.
Assuming you are using SOAP as your transport mechanism in RPC Subscribe -> Read XML Transform, the following link gives you a working example of a SOAP client:
Working Soap client example
if you can test your web service using the component Call Ab-Initio RPC, and a record format of:
include "~$AB_HOME/connectors/RPC/rpcheader.dml";
include "~$AB_HOME/connectors/SOAP/SOAPRequest.dml";
metadata type = record
rpcheader hdrs;
SOAPRequest soaphdrs;
utf8 string(big endian integer(4)) body;
end;
then modifying the java code in the link to assign appropriate field name values should work.
Related
I was searching on google but not found any helpful article on this.
I want to invoke webservice methods.I have wdsl and i have to invoke dynamically without creating any stubs as such.Any example will be more helpful.
Hope you are searching for a tool for invoking web services. Better user Soap UI
Soap UI is a tool which acts as a client to connect with your webservices.
Interesting question. After a little research i found this project on github which seems to fulfill your needs.
https://github.com/reficio/soap-ws
Here is some sample code from the github site which seems very easy and straightforward.
Consume a Web-Serivce in 60 seconds
Let's consume the CurrencyConverter Web-Service. Thanks to the fluent builders the API is straigtforward and intuitive. Does it need any explanation? Welcome to soap-ws :)
Wsdl wsdl = Wsdl.parse("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL");
SoapBuilder builder = wsdl.binding()
.localPart("CurrencyConvertorSoap")
.find();
SoapOperation operation = builder.operation()
.soapAction("http://www.webserviceX.NET/ConversionRate")
.find();
Request request = builder.buildInputMessage(operation)
SoapClient client = SoapClient.builder()
.endpointUrl("http://www.webservicex.net/CurrencyConvertor.asmx")
.build();
String response = client.post(request);
Soap Ui is a application used for testing the web service generated. You only need the Wsdl for doing the same.
here is a link.
right click the generated wsdl > run as > run in server.
copy the url from the address bar of the browser.
open soap iu and click on new project.
paste the url in the wsdl column.
the project will be listed with the name of the method.
expand the method and click on request1.
enter the values in the "?" which are the parameters to the method.
click the run button.
this a method for mocking the web service created without creating a client. The soap Ui application can work as client.
Hope this helps.
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
i want to invoke a web service based on the url and method name,when given the input parament in xml format ,i need to invoke the web service ,but i can't generate the client stub using tools like wsdl2java because the url and method name are given dynamically so these class aren't compiled.
for example,http://localhost:9090:/hello?wsdl there have a method
string sayhello(String []names); the input param likes <arg0>john</arg0> <arg0>lucy</arg0>
it seems that i need to generate soap request in code so is there any library can help me do this?
thank you for giving any recommendation!
That's possible and yes, you will need to generate the SOAP request yourself and also parse the reply yourself.
Some links to help with this including source code etc.:
SoapUI (complete source code of a generic SOAP client including a nice UI)
http://anshu-manymoods.blogspot.com/2009/10/how-to-simple-generic-soap-test-client.html
http://www.java-tips.org/other-api-tips/httpclient/how-to-send-an-xml-document-to-a-remote-web-server-using-http-5.html
http://biomoby.open-bio.org/CVS_CONTENT/moby-live/Java/docs/soapServlet.html
http://www.soapuser.com/ngx_22jul01.html
IF JavaScript is an option you can check this out...
There's SAAJ but it's pretty verbose.
If you can use Spring, Spring-WS has a number of client options.
You can always just build up the XML by hand, too (and parse the returned XML).
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/