You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Thomas Kippenberg <ki...@web.de> on 2006/05/19 12:58:17 UTC

Generating SOAP-Header with WSDL2Java from WSDL file

Hello,

I'm trying to generate Java code from WSDL with WSDL2Java. Everything works fine until I try to generate SOAP-Headers in the Input Message. WSDL2Java does not complain, however the generated file xxxStub.java contains references to "param4", which is not defined. The buggy code looks like that (beginning with line 124)


                                        // add the children only if the parameter is not null
                                        if (param4!=null){
                                        env.getHeader().addChild(toOM(param4, optimizeContent(new javax.xml.namespace.QName("", "RequestSecurityToken"))));
                                        }


I'm using Axis2 Version 1.0 and JDK1.5.0_6. Below you find an example WSDL.

Is this an error within WSDL2Java or withing my WSDL file? How can I fix the problem?

Thanks a lot,

Thomas



---
<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="http://localhost:7777"
			xmlns:tns="http://localhost:7777"
			xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
			xmlns:xsd="http://www.w3.org/2001/XMLSchema"
			xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
			xmlns="http://schemas.xmlsoap.org/wsdl/">
	
<message name="SecurityTokenInput">
<part name="testInput" type="xsd:string"/>
<part name="headerInput" type="xsd:string"/>
</message>

<message name="SecurityTokenOutput">
<part name="testOutput" type="xsd:string"/>
</message> 
	
<portType name="SecurityTokenPortType">
<operation name="RequestSecurityToken">      
<input message="tns:SecurityTokenInput"/>      
<output message="tns:SecurityTokenOutput"/>  
</operation>
</portType>
	
<binding name="SecurityTokenBinding" type="tns:SecurityTokenPortType" >
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="RequestSecurityToken">
<soap:operation soapAction="" />
<input>
<soap:header message="tns:SecurityTokenInput" part="headerInput" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>	
<soap:body parts="testInput" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>		    
</input>
<output>
<soap:body parts="testOutput" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
   	
<service name="SecurityTokenService">
<port binding="tns:SecurityTokenBinding">
<soap:address location="http://localhost:7777/STS"/>
</port>
</service>	

</definitions>



_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Generating SOAP-Header with WSDL2Java from WSDL file

Posted by Anne Thomas Manes <at...@gmail.com>.
Your WSDL has errors. Document/encoded is not a valid combination.

When using document style, your message parts must reference element
definitions (rather than types). That means you must provide a <types>
section and a schema to define your elements.

Note, also, that the normal practice is to not include header definitions in
the WSDL. Headers are typically managed by handlers rather than the
application.

Anne


On 5/19/06, Thomas Kippenberg <ki...@web.de> wrote:
>
> Hello,
>
> I'm trying to generate Java code from WSDL with WSDL2Java. Everything
> works fine until I try to generate SOAP-Headers in the Input Message.
> WSDL2Java does not complain, however the generated file xxxStub.javacontains references to "param4", which is not defined. The buggy code looks
> like that (beginning with line 124)
>
>
>                                         // add the children only if the
> parameter is not null
>                                         if (param4!=null){
>                                         env.getHeader().addChild(toOM(param4,
> optimizeContent(new javax.xml.namespace.QName("",
> "RequestSecurityToken"))));
>                                         }
>
>
> I'm using Axis2 Version 1.0 and JDK1.5.0_6. Below you find an example
> WSDL.
>
> Is this an error within WSDL2Java or withing my WSDL file? How can I fix
> the problem?
>
> Thanks a lot,
>
> Thomas
>
>
>
> ---
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions targetNamespace="http://localhost:7777"
>                         xmlns:tns="http://localhost:7777"
>                         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>                         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>                         xmlns:wsse="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
> "
>                         xmlns="http://schemas.xmlsoap.org/wsdl/">
>
> <message name="SecurityTokenInput">
> <part name="testInput" type="xsd:string"/>
> <part name="headerInput" type="xsd:string"/>
> </message>
>
> <message name="SecurityTokenOutput">
> <part name="testOutput" type="xsd:string"/>
> </message>
>
> <portType name="SecurityTokenPortType">
> <operation name="RequestSecurityToken">
> <input message="tns:SecurityTokenInput"/>
> <output message="tns:SecurityTokenOutput"/>
> </operation>
> </portType>
>
> <binding name="SecurityTokenBinding" type="tns:SecurityTokenPortType" >
> <soap:binding style="document" transport="
> http://schemas.xmlsoap.org/soap/http" />
> <operation name="RequestSecurityToken">
> <soap:operation soapAction="" />
> <input>
> <soap:header message="tns:SecurityTokenInput" part="headerInput"
> use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
> <soap:body parts="testInput" use="encoded" encodingStyle="
> http://schemas.xmlsoap.org/soap/encoding/"/>
> </input>
> <output>
> <soap:body parts="testOutput" use="encoded" encodingStyle="
> http://schemas.xmlsoap.org/soap/encoding/"/>
> </output>
> </operation>
> </binding>
>
> <service name="SecurityTokenService">
> <port binding="tns:SecurityTokenBinding">
> <soap:address location="http://localhost:7777/STS"/>
> </port>
> </service>
>
> </definitions>
>
>
>
> _______________________________________________________________
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>