I need to call a SOAP function and pass the correct data. I have been trying this for hours now and I cannot get it to work. Below I copied the current "try" and also the appropriate info from the WSDL and XSD files.
The current response I now get is:
SOAP request contains invalid XML
It has something to do with the complexType "Searchpath", but I don't know what. If I make $content an empty string (just to test) I get the error "Searchpath is required"
Current PHP snippet:
$content = new SoapVar('<ns1:Searchpath xsi:type="ns1:SearchpathOnMessagetype"><ns2:Messagetype>JW</ns2:Messagetype></ns1:Searchpath>', XSD_ANYXML);
$request = array(
"RetrieveListMessages" => array(
"Request" => array(
"Searchpath" => $content
)
)
);
$response = $soapClient->__call('RetrieveListMessages', $request);
I have create working SOAP calls in the past, but I have never had an empty complexType (Searchpath) which is used as a base in another complexType (SearchpathOnMessagetype). I read many posts on this forum and also tried searching on Google, but with no result.
Hopefully someone can help me out, but als explain the use of the empty complexType/base situtation so I can learn from it. If I need to provide more information, just let me know.
Info from the WSDL file:
<xsd:element name="RetrieveListMessages">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" nillable="true" name="Request" type="messages:RetrieveListMessagesRequest" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Info from the Messages xsd file:
<xs:complexType name="RetrieveListMessagesRequest">
<xs:sequence>
<xs:element name="Searchpath" type="types:Searchpath" />
</xs:sequence>
</xs:complexType>
Info from the Types xsd file:
<xs:complexType name="Searchpath">
<xs:sequence>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SearchpathOnMessagetype">
<xs:complexContent>
<xs:extension base="types:Searchpath">
<xs:sequence>
<xs:element name="Messagetype" type="xs:string" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…