I had similar problems with trying to use a SOAP Header.  I built my WSDL using 
VIM but when I tried to compile it I got errors.

I used Eclipse (you could also use the 30-day trial of XMLSpy Enterprise) to 
build a small example from which I figured out what I was doing wrong.  I was 
having namespace problems.

I did a lot of trial and error, but the solution for me was adding 
'namespace="tns"' to the "<soap:header>" element.  The WSDL validated and gsoap 
generated working code.

I've only been working with WSDL and XSD for a few weeks so I'm by no means an 
expert.  If there is a better / proper way to do this, please let me know.

Below is the parts of the WSDL that I think are relevant to making  gsoap 
generate working code.

Hope that helps,
Jamie

----

<wsdl:definitions
 xmlns:tns="urn:myDefinitions"
 xmlns:ns1="urn:myTypes"
 ...>
 <wsdl:types>
  <xsd:schema ...>
   <xsd:import namepace="urn:myTypes" schemaLocation="..."/>
  </xsd:schema>
 <wsdl:types>
 <wsdl:message name="SessionIdHeader">
  <wsdl:part name="session_id" type="ns1:SessionId"/>
 </wsdl:message>
 <wsd:binding ...>
  <soap:binding style="document" .../>
  <wsdl:operation name="UserProfileCreate">
   <soap:operation soapAction="..." style="document"/>
   <wsdl:input>
    <soap:body use="literal"/>
    <soap:header use="literal" required="true"
     message="tns:SessionIdHeader" part="session_id" namespace="tns"/>
   </wsdl:input>
   <wsdl:output>...</wsdl:output>
  </wsdl:operation>
 </wsdl:binding>
</wsdl:definitions>

Reply via email to