Hai friend
I am not clear Please can u expline breifly
vssp
Hai,
First thanks for your humble reply.
The problem which im facing is as follows:
given below are complet set of code....
hope ull hav a very good undetstanding by now.
Issue #1 : namespaces are not being mapped properly.
Issue #2 : If namespaces are mapped then the attribute "
elementFormDefault" must be added.
Needed Result : Without any change in WSDL by coding in PHP need to solve this problem.
Anticipating ur fav reply.
MyClient.php
<?php
include('myResponse.php');
include('MyRequest.php');
$myResponse = new myResponse();
$MyRequest = new MyRequest();
$MyRequest->CustomerNumber = 123;
$MyRequest->Unit = 'ABC';
$myResponse ->MyRequest= $MyRequest;
$client = new SoapClient('http://localhost/MyLocalProxy?WSDL',array('trace'=>1));
try{
$response = $client->myResponse($myResponse);
$error = $response->MyResponse->error;
echo "Error Code ".$error->ErrorCode."<br>";
echo "Error Message ".$error->ErrorMessage."<br>";
} catch (SoapFault $e) {
echo $e;
}
echo "Last request Headers".$client->__getLastRequest()."<br>";
echo "Last request ".$client->__getLastRequest()."<br>";
echo "Last response <xmp>\n".
$client->__getLastResponse()."</xmp><br><br>";
?>
XML Request Required XML Request Following is the required XML request by the server before changing WSDL. Element MyRequest is mapped with ns1 namespace.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://abc.com/GBTSTo/GBTSTReq/01" xmlns:ns2="http://abc.com/GBTST">
<SOAP-ENV:Body>
<ns2:gBlTST>
<ns1:GSTBTReq>
<CustomerNumber>123</CustomerNumber>
<Unit>ABC</Unit>
</ns1:GSTBTReq>
</ns2:gBlTST>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Generated XML Request before changing WSDL This is the XML request generated by the above PHP client code before changing the WSDL i.e. before adding elementFormDefault="qualified" in WSDL schema. Element GSTBTReq doesn’t contain namespace which causes ALSB[AquaLogicServiceBus] validation to fail.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://abc.com/GBTST">
<SOAP-ENV:Body>
<ns1:gBTST>
<GSTBTReq>
<!— TODO : namespace not mapped here -- >
<CustomerNumber>45</CustomerNumber>
<Unit>DEF</Unit>
</GSTBTReq>
</ns1:gBTST>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Generated XML Request after changing WSDL
This is the XML request generated by the above PHP client code after changing the WSDL ie after adding elementFormDefault="qualified" in WSDL schema. Element GSTBTReq is now mapped with ns1 namespace. This input also gets the response from the server with no ALSB validation fail.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://abc.com/GBTST/GBTSTReq/01" xmlns:ns2="http://abc.com/GBTST">
<SOAP-ENV:Body>
<ns2:gBTST>
<ns1:GSTBTReq>
<ns1:CustomerNumber>576</ns1:CustomerNumber>
<ns1:Unit>US</ns1:Unit>
<ns1:GSTBTReq>
</ns2:gBTST>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Change in WSDL
Following wsdl block is part of GBTST WSDL file. Attribute elementFormDefault="qualified" is added to the second schema which is required to generate required XML input.
<s:schema elementFormDefault="qualified" targetNamespace="http://abc.com/GBTST" xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/" xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
<s:import namespace="http://abc.com/GBTST/GBTSTReq/01"/>
<s:import namespace="http://abc.com/GBTST/GBTSTResp/01"/>
<s:element name="gBTST">
<s:complexType>
<s:sequence>
<s:element ref="ns:GSTBTReq"/>
<!— TODO : element defined in other schema for which namespace is not mapped in the request -->
</s:sequence>
</s:complexType>
</s:element>
<s:element name= "gBTSTResp">
<s:complexType>
<s:sequence>
<s:element ref="ns1:GSTBTResp"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
<!— TODO : Added attribute elementFormDefault="qualified" to solve the problem -- >
<s:schema elementFormDefault="qualified" targetNamespace="http://abc.com/GBTST/GBTSTReq/01" xmlns:common="http://abc.com/Common/01" xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/" xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:req="http://abc.com/GBTST/GBTSTReq/01" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<s:import namespace="http://abc.com/Common/01"/>
<s:simpleType name="CustomerNumber">
<s:restriction base="xsd:integer"/>
</s:simpleType>
<s:simpleType name="Unit">
<s:restriction base="xsd:string">
<s:enumeration value="ABC"/>
</s:restriction>
</s:simpleType>
<s:element name="GSTBTReq">
<s:complexType>
<s:sequence>
<s:element name="CustomerNumber" nillable="false" type="req:CustomerNumber"/>
<s:element name="Unit" nillable="false" type="req:OperatingUnit"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
Thanks in Advance ...