This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Web Services and the fly likes Create / Generate Soap Header client stub / java classes using JAX-RPC API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Create / Generate Soap Header client stub / java classes using JAX-RPC API" Watch "Create / Generate Soap Header client stub / java classes using JAX-RPC API" New topic
Author

Create / Generate Soap Header client stub / java classes using JAX-RPC API

naveen babu
Greenhorn

Joined: Aug 13, 2008
Posts: 3
Dear Friends,

I tried to generate the Web Service Client Stub in Netbeans 6.1 IDE, but the IDE is generating the Soap Body and not generating the Soap Header stub / java classes.

Can any one help me how to create the Client Soap Header java classes using JAX-RPC API. I want to conver the below wsdl to java classes and use it thru the mobile.

Please some one help me as it is very urgent.

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://localhost/sdk/customerservice" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://localhost/sdk/customerservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://localhost/sdk/customerservice">
<s:element name="Authenticate">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="username" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="AuthenticateResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="AuthenticateResult" type="tns:AuthenticationResult" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="AuthenticationResult">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="CustomerID" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="IsAuthenticated" type="s:boolean" />
</s:sequence>
</s:complexType>
<s:element name="ApiToken" type="tns:ApiToken" />
<s:complexType name="ApiToken">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Token" type="s:string" />
</s:sequence>
<s:anyAttribute />
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="AuthenticateSoapIn">
<wsdl:part name="parameters" element="tns:Authenticate" />
</wsdl:message>
<wsdl:message name="AuthenticateSoapOut">
<wsdl:part name="parameters" element="tns:AuthenticateResponse" />
</wsdl:message>
<wsdl:message name="AuthenticateApiToken">
<wsdl:part name="ApiToken" element="tns:ApiToken" />
</wsdl:message>
<wsdl:portType name="CustomerServiceSoap">
<wsdlperation name="Authenticate">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Returns the customer id for the authenticated customer. If the authentication failed the returned value will be -1</wsdl:documentation>
<wsdl:input message="tns:AuthenticateSoapIn" />
<wsdlutput message="tns:AuthenticateSoapOut" />
</wsdlperation>
</wsdl:portType>
<wsdl:binding name="CustomerServiceSoap" type="tns:CustomerServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdlperation name="Authenticate">
<soapperation soapAction="http://localhost/sdk/customerservice/Authenticate" style="document" />
<wsdl:input>
<soap:body use="literal" />
<soap:header message="tns:AuthenticateApiToken" part="ApiToken" use="literal" />
</wsdl:input>
<wsdlutput>
<soap:body use="literal" />
</wsdlutput>
</wsdlperation>
</wsdl:binding>
<wsdl:binding name="CustomerServiceSoap12" type="tns:CustomerServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdlperation name="Authenticate">
<soap12peration soapAction="http://localhost/sdk/customerservice/Authenticate" style="document" />
<wsdl:input>
<soap12:body use="literal" />
<soap12:header message="tns:AuthenticateApiToken" part="ApiToken" use="literal" />
</wsdl:input>
<wsdlutput>
<soap12:body use="literal" />
</wsdlutput>
</wsdlperation>
</wsdl:binding>
<wsdl:service name="CustomerService">
<wsdl:port name="CustomerServiceSoap" binding="tns:CustomerServiceSoap">
<soap:address location="https://localhost/soap/customerservice.asmx" />
</wsdl:port>
<wsdl:port name="CustomerServiceSoap12" binding="tns:CustomerServiceSoap12">
<soap12:address location="https://localhost/soap/customerservice.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
Hello "naveen naveen"-

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.

As to your question, what do you mean by "SOAP body" and "SOAP header"? The tools don't generate any SOAP, they generate code to make and/or receive SOAP requests. If that's not what's happening in your case, tell us what is happening.


Ping & DNS - updated with new look and Ping home screen widget
Karthic Raghupathi
Greenhorn

Joined: Nov 23, 2009
Posts: 9

I guess what he meant was the Netbeans IDE does not generate the stub which includes handling the Authentication. Let me explain a bit. I'm having the same issue currently.

I'm trying to consume a web service created in .NET which needs SOAP authentication. Here is a link to the webservice.

The part that you would be most interested is this:


When consuming the web service using the instuctions given here under the sections "Creating Proxy in Java" and "Write code in Java to call web service" fails because we are not able to add the authentication part in the code.

When automatically generating the code in Netbeans it gives us this:

Using JAX-WS


Using JAX-RPC


At the least when I use JAX-WS method, I get a class called SoapAuthenticationHeader in which I can set the username and password. But I'm not able to bind it with the service or port objects.


I do not have this option in JAX-RPC method.

Any inputs on this would be greatly appreciated. Thanks in advance for your time.
Karthic Raghupathi
Greenhorn

Joined: Nov 23, 2009
Posts: 9

bump

pardon me.. i was just hoping this post would catch your attention... if it is against forum rules, please forgive my ignorance...
Annu Vinayak
Greenhorn

Joined: Jul 17, 2009
Posts: 19
I see that there are no replies to the message by Karthic Raghupathi.

I am facing a smiliar scenario and need to add an authentication header to a JAX RPC client. (The autogenerated stub classes do not contain any classes for adding the header to my SOAP message)

Reuqest you to provide some information on this issue.

Thanks,
Annu
Karthic Raghupathi
Greenhorn

Joined: Nov 23, 2009
Posts: 9

I keep running into such issues every now and then.

I come back to see if there is an answer but no luck yet. Hopefully someone will have an answer soon enough.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create / Generate Soap Header client stub / java classes using JAX-RPC API
 
Similar Threads
got error when call to >net webservice from java client
access to .net web service
How to call update functionality from Java using web service
Empty target namespace with axis1.2
problem calling a remote webservice [ Algo Error]