I need some technical help in webservices. I should invoke a Axis2/SOAP WS-I compliant Web Service from a web application.
I tried to use stubs, but it is not working. When hitting the end point url, I should pass object (complex datatype in wsdl file) as parameter. Could any one help me where to start?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35223
7
posted
0
Welcome to JavaRanch.
I tried to use stubs, but it is not working.
What does this mean? Where did these stubs come from, how were you using them, and what exactly was the result?
when I search in the net, i am getting the following example. but i need to pass an object as parameter. Can any one please help me How to pass an object to call.addparameter() mehtod?
It is defined as follows in wsdl file. <complexType name="xyzpPacket"> − <sequence> <element name="userName" nillable="true" type="xsd:string"/> <element name="domain" nillable="true" type="xsd:string"/> <element name="domainAuth" type="xsd:boolean"/> <element name="userId" nillable="true" type="xsd:long"/> .... </sequence> </complexType>
thanks for the reply. Should I use the same method, even if I am calling it from a web application.
Thanks in advance
Kalyani
kalyani goli
Greenhorn
Joined: Nov 26, 2008
Posts: 4
posted
0
Thanks for the reply when should I use the AXIOMClient class using AXIOM.
So, I need to have stubs to access the web service. I can't access just by mentioning end point URL and passing parameters as shown in the example.
Could you please elaborate on this.
Thanks in advance, Kalyani
Peer Reynders
Bartender
Joined: Aug 19, 2005
Posts: 2906
posted
0
Originally posted by kalyani goli: Should I use the same method, even if I am calling it from a web application.
You should be able to use the stub in a web application. However, as you are doing this for the first time, I'd suggest attempting it as a command line client first, so that you can iron out your own understanding of how to use the generated artifacts first.
when should I use the AXIOMClient class using AXIOM
You have a WSDL - so you should be using WSDL2Java to generate a stub. The stub will make Java representations of the XML available. Writing a Web Service Client
By default WSDL2Java uses Axis2 Data Binding (ADB) (So this might interest you).
If you don't mind the extra work you could try data binding with JiBX which lets you configure mappings between your own objects and the XML required by the WSDL.
I can't access just by mentioning end point URL and passing parameters as shown in the example.
Not unless you want to manually derive the formal structure of the supported SOAP requests and responses from the WSDL that you were handed and then programmatically build the requests from scratch, to later pry the result out of the SOAP response with SAAJ (or AXIOM).
The code example you showed accessed a RPC/encoded web service - Axis2 doesn't even support the RPC/encoded messaging mode anymore; it caused nothing but trouble (they weren't compliant with the WS-I Basic Profile).
With Axis2 org.apache.axis2.rpc.client.RPCServiceClient fills a similar niche. However it isn't interoperable and will not generate the requests that you need. [ November 26, 2008: Message edited by: Peer Reynders ]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.