• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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">
<wsdl:operation 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" />
<wsdl:output message="tns:AuthenticateSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CustomerServiceSoap" type="tns:CustomerServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Authenticate">
<soap:operation 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>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="CustomerServiceSoap12" type="tns:CustomerServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Authenticate">
<soap12:operation 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>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</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>
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 9
jQuery Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9
jQuery Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
bump

pardon me.. i was just hoping this post would catch your attention... if it is against forum rules, please forgive my ignorance...
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9
jQuery Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Did Steve tell you that? Fuh - Steve. Just look at this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic