Search code examples
web-servicessoapxsdwsdlgsoap

gSOAP and general SOAP problem


I am using gSOAP to create C++ code from a WSDL document. The problem is gSOAP is giving me errors when I run the wsdl2h tool on my WSDL file. The errors are all related to namespace issues. For example

Warning: could not find element 'GetRPCMethods' type '"http://www.broadband-forum.org/cwmp/cwmp-1-2.xsd":GetRPCMethods' in schema urn:tr069

I have pasted the namespace definitions and an example of how they are used below. Anyone know where I am going wrong?

urn:tr069 is supposed to refer to the current document.

<s0:definitions 
    name="tr069"
    xmlns:s0="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:s1="urn:tr069"
    xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/"
    targetNamespace="urn:tr069">

<s0:types>

<xsd:schema 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:tns="urn:tr069" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd1="http://www.broadband-forum.org/cwmp/cwmp-1-2.xsd"
    targetNamespace="urn:tr069">

  <xsd:import namespace="urn:dslforum-org:cwmp-1-2" schemaLocation="cwmp-1-2.xsd" />
  <xsd:element name="GetRPCMethods" type="xsd1:GetRPCMethods" />
</xsd:schema>
</s0:types>
<s0:message name="GetRPCMethods">
     <s0:part element="s1:GetRPCMethods" name="GetRPCMethods" />
</s0:message>
</s0:definitions>

I have a few other questions, as I understand it the target namespace does not have to point to a real location, it is just a convention for pointing to the current document, Is this correct? Also in cwmp-1-2.xsd there is an element called GetRPCMethods which contains a sequence containing another element. Is it best practice to use this whole element(GetRPCMethods) as a part for a message as I have above or should I define the specific parts of GetRPCMethods in the message?

Thank you.


Solution

  • The problem was the elements defined in the <schema> tag. First I removed all the defined elements inside the <schema> tag because they were completely unnecessary anyway. Then I changed the namespace of the elements in the message parts from s1 to xsd1 to use the elements in cwmp-1-2.xsd instead of the ones I defined in the <schema> tag.

    As for my other questions, the targetNameSpace does not have to point to a real uri, it is just a name for the namespace of this document. For my second question, I think it is probably best and easiest to use the whole schema element as the part for the message.