|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
SOAP message structure passing between SOAP client/serverHello,
I am trying to write a SOAP client / server app & cannot get the SOAP message structures passed back and forth between the client & servers: Attached are the WSDL, XSDs, XML example, & PHP that is causing me so much grieve. Has anyone any ideal what I am doing wrong? I've not attached some of the schemas and skeleton php files. This is Mac osX, PHP 5.3 with SOAP extension & apache 2.2.x. Thanks. AmazonServices.wsdlAmazonServicesClient.phpAmazonServicesServer.phpamzn-envelope.xmlAmazonServices.phpXMLlibrary.phpamzn-envelope.xsdamzn-base.xsdamzn-header.xsdFulfillmentCenter.xsd |
|
|
Re: SOAP message structure passing between SOAP client/serverAlso it would propably help if I showed the output I am currently getting from the SOAP client/server.
This is from the client PHP SOAP extension output functions. The first part of the output isjust where I echoed the XML file before converting it to a PHP array structure to pass through the SOAP server class call. <?xml version="1.0" encoding="UTF-8"?> <tnt:AmazonEnvelope xmlns:tnt="urn:schemas:tnt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:schemas:tnt schemas/Amazon/amzn-envelope.xsd"> <tnt:Header> <tnt:DocumentVersion>1.1</tnt:DocumentVersion> <tnt:MerchantIdentifier>M_STORENAME_8675309</tnt:MerchantIdentifier> <tnt:OverrideReleaseId>1.0</tnt:OverrideReleaseId> </tnt:Header> <tnt:MessageType>FulfillmentCenter</tnt:MessageType> <tnt:PurgeAndReplace>true</tnt:PurgeAndReplace> <tnt:EffectiveDate>2009-10-31T00:00:00</tnt:EffectiveDate> <tnt:Message> <tnt:MessageID>8675309</tnt:MessageID> <tnt:OperationType>Update</tnt:OperationType> <tnt:FulfillmentCenter> <tnt:FulfillmentCenterID>TrollAndToadStore</tnt:FulfillmentCenterID> <tnt:SupportsInStorePickup>true</tnt:SupportsInStorePickup> <tnt:OperatingHours> <tnt:Monday> <tnt:Open>09:00:00</tnt:Open> <tnt:Close>17:00:00</tnt:Close> </tnt:Monday> <tnt:Tuesday> <tnt:Open>09:00:00</tnt:Open> <tnt:Close>17:00:00</tnt:Close> </tnt:Tuesday> <tnt:Wednesday> <tnt:Open>09:00:00</tnt:Open> <tnt:Close>17:00:00</tnt:Close> </tnt:Wednesday> <tnt:Thursday> <tnt:Open>09:00:00</tnt:Open> <tnt:Close>17:00:00</tnt:Close> </tnt:Thursday> <tnt:Friday> <tnt:Open>09:00:00</tnt:Open> <tnt:Close>17:00:00</tnt:Close> </tnt:Friday> <tnt:Saturday> <tnt:Open>09:00:00</tnt:Open> <tnt:Close>17:00:00</tnt:Close> </tnt:Saturday> <tnt:Sunday> <tnt:Open>09:00:00</tnt:Open> <tnt:Close>17:00:00</tnt:Close> </tnt:Sunday> </tnt:OperatingHours> </tnt:FulfillmentCenter> </tnt:Message> </tnt:AmazonEnvelope> <br/><br/>Dumping request headers: <br/>POST /Amazon/AmazonServicesServer.php HTTP/1.1 Host: 127.0.0.1 Connection: Keep-Alive User-Agent: PHP-SOAP/5.3.0 Content-Type: application/soap+xml; charset=utf-8; action="http://127.0.0.1/Amazon/AmazonServices" Content-Length: 222 <br/><br/>Dumping request: </br/><?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://127.0.0.1/Amazon/AmazonServices.wsdl"><env:Body><ns1:AmazonServicesPut/></env:Body></env:Envelope> <br/><br/>Dumping response headers: <br/>HTTP/1.1 200 OK Date: Mon, 19 Oct 2009 13:16:28 GMT Server: Apache/2.2.11 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8k DAV/2 PHP/5.3.0 X-Powered-By: PHP/5.3.0 Content-Length: 222 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: application/soap+xml; charset=utf-8 <br/><br/>Dumping response: <br/><?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://127.0.0.1/Amazon/AmazonServices.wsdl"><env:Body><ns1:AmazonServicesGet/></env:Body></env:Envelope> <br/></p><br/>
|
|
|
Re: SOAP message structure passing between SOAP client/serverHello,
Well I figured it out. It wasn't that the complex types weren't defined, but the my confusion over similarly named existing and newly defined name spaces that seem arbitrary in some examples and well defined URLs in others. Anyway, because mangle namespaces seem to be the root of most questions I've seen regarding SOAP and to help other newbies in SOAP, WSDL, and WebSerives I'll port my mistake & correction here: In my AmazonServices.wsdl file I had: <wsdl:definitions name="AmazonServices" targetNamespace="http://127.0.0.1/Amazon/AmazonServices.wsdl" xmlns:tntsoap="http://127.0.0.1/Amazon/AmazonServices.wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tnt="urn:schemas:tnt"> with needed to be changed to: <wsdl:definitions name="AmazonServices" targetNamespace="http://127.0.0.1/Amazon/AmazonServices" xmlns:tntsoap="http://127.0.0.1/Amazon/AmazonServices" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tnt="urn:schemas:tnt"> because lower down in the WSDL I defined as the operation endpoint: <wsdl:operation name="AmazonServices"> <soap:operation soapAction="http://127.0.0.1/Amazon/AmazonServices"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> --- targetNamespace="http://127.0.0.1/Amazon/AmazonServices.wsdl" xmlns:tntsoap="http://127.0.0.1/Amazon/AmazonServices.wsdl" +++ targetNamespace="http://127.0.0.1/Amazon/AmazonServices" xmlns:tntsoap="http://127.0.0.1/Amazon/AmazonServices" I suppose I could have changed the wsdl:operation endpoint to end as in the wsdl:definitions. What I don't like is the the operation endpoint defined pointed nowhere until fixed the wsdl:definitions but the soap client or server didn't complain about not being able to bind to the defined endpoint namespace but then I guess that is cloud computing. Thanks. Regards, Andrew
|
|
|
Re: SOAP message structure passing between SOAP client/serverWell I'm back to square one.
My previous message broke the import of the complex type imported from the schema and so PHP was passing a XML document as a string back and forth between the SOAP client / server making it look like it was working. Sorry to bother you. |
|
|
Re: SOAP message structure passing between SOAP client/serverOK, last one for a while. It's not easy to lean PHP, XML, XSD, SOAP, & WSDL all at the same time.
All my grief was again a namespace problem because simplexml_load_string didn't know what to do with the namespace prefix 'tnt' that I had to prepend to the Amazon schemas in order to get the PHP WSDL & SOAP extension to create the PHP types out of the complex types in the schemas and so simplexml_load_string was returning FALSE. I changed this: $xmlobj = simplexml_load_string($xmlstr); to this: $xmlobj = simplexml_load_string($xmlstr, NULL, NULL, "tnt", true); and now get back a simplexml object as expected. Thanks.
|
| Free embeddable forum powered by Nabble | Forum Help |