logo       

Re: Problem with SOAP envelope?: msg#00089

php.nusoap.general

Subject: Re: Problem with SOAP envelope?

> 1. add "?debug=1" to the URL to which you POST, or
> 2. add the line "$debug = 1;" to your server code
>the response from the server will include its debug in an XML comment.

I did the above. I found out that due to the data (including the envelope)
being posted, the following is what the server was actually getting:

----------------------------

sXMLString=%3CSOAP-ENV%3AEnvelope+SOAP-ENV%3AencodingStyle%3D%22http%3A%2F%2
Fschemas.xmlsoap.org%2Fsoap%2Fencoding%2F%22++xmlns%3ASOAP-ENV%3D%22http%3A%
2F%2Fschemas.xmlsoap.org%2Fsoap%2Fenvelope%2F%22++xmlns%3Axsd%3D%22http%3A%2
F%2Fwww.w3.org%2F2001%2FXMLSchema%22++xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.o
rg%2F2001%2FXMLSchema-instance%22++xmlns%3ASOAP-ENC%3D%22http%3A%2F%2Fschema
s.xmlsoap.org%2Fsoap%2Fencoding%2F%22++xmlns%3Asi%3D%22http%3A%2F%2Fsoapinte
rop.org%2Fxsd%22%3E%3CSOAP-ENV%3ABody%3E%3Cns1%3APolicyInterfaceWebService+x
mlns%3Ans1%3D%22http%3A%2F%2Ftesturi.org%22%3E%3CsXMLString+xsi%3Atype%3D%22
xsd%3Astring%22%3E%0D%0A%3CIntegrusEPLLitePolicyInterface%3E%0D%0A%09%3CUser
Record%3E%0D%0A%09%09%3Cfirstname%3ETest%3C%2Ffirstname%3E%0D%0A%09%09%3Clas
tname%3EUser%3C%2Flastname%3E%0D%0A%09%09%3Ccompany%3EZed+Zed+Webservice+Tes
t+Company%3C%2Fcompany%3E%0D%0A%09%09%3Caddress1%3EAddress+1%3C%2Faddress1%3
E%0D%0A%09%09%3Caddress2%3EAddress+2%3C%2Faddress2%3E%0D%0A%09%09%3Ccity%3EC
ity%3C%2Fcity%3E%0D%0A%09%09%3Cstate%3EState%3C%2Fstate%3E%0D%0A%09%09%3Ccou
ntry%3EUnited+States%3C%2Fcountry%3E%0D%0A%09%09%3Czip%3E70433%3C%2Fzip%3E%0
D%0A%09%09%3Cphone%3E1231231234%3C%2Fphone%3E%0D%0A%09%09%3Cfax%3E1231231235
%3C%2Ffax%3E%0D%0A%09%09%3Cemail%3Echris%40wild.net%3C%2Femail%3E%0D%0A%09%0
9%3Cbilling_email%3Echris%40wild.net%3C%2Fbilling_email%3E%0D%0A%09%3C%2FUse
rRecord%3E%0D%0A%09%3Corg_structure%3ECorporation%3C%2Forg_structure%3E%0D%0
A%09%3Cnaics_number%3E444220%3C%2Fnaics_number%3E%0D%0A%09%3Cprimary_categor
y%3ERetail%3C%2Fprimary_category%3E%0D%0A%09%3Csub_category%3ENurseries%2C+G
arden+Centers%2C+and+Farm+Supply+Stores%3C%2Fsub_category%3E%0D%0A%09%3Cfull
time_employee%3E25%3C%2Ffulltime_employee%3E%0D%0A%09%3Cseasonal_employee%3E
10%3C%2Fseasonal_employee%3E%0D%0A%09%3Criskman_product%3EYes%3C%2Friskman_p
roduct%3E%0D%0A%09%3Cprevious_claims%3ENo%3C%2Fprevious_claims%3E%0D%0A%09%3
Cclaims_not_reported%3ENo%3C%2Fclaims_not_reported%3E%0D%0A%09%3Crdi_or_fpa%
3EFull+Prior+Acts%3C%2Frdi_or_fpa%3E%0D%0A%09%3Cmaterial_facts%3ENo%3C%2Fmat
erial_facts%3E%0D%0A%09%3CAttachedEndorsements%3E%0D%0A%09%09%3Cendorsement_
type%3Eadditional%3C%2Fendorsement_type%3E%0D%0A%09%09%3Cpremium%3E3.14%3C%2
Fpremium%3E%0D%0A%09%09%3Cpremium_due%3E3.14%3C%2Fpremium_due%3E%0D%0A%09%09
%3Cendorsement_body%3ETest+Additional+Premium+Endorsement%3C%2Fendorsement_b
ody%3E%0D%0A%09%3C%2FAttachedEndorsements%3E%0D%0A%09%3CAttachedEndorsements
%3E%0D%0A%09%09%3Cendorsement_type%3Etext%3C%2Fendorsement_type%3E%0D%0A%09%
09%3Cpremium%3E0%3C%2Fpremium%3E%0D%0A%09%09%3Cpremium_due%3E0%3C%2Fpremium_
due%3E%0D%0A%09%09%3Cendorsement_body%3ETest+Text+Endorsement%3C%2Fendorseme
nt_body%3E%0D%0A%09%3C%2FAttachedEndorsements%3E%0D%0A%09%3CAttachedEndorsem
ents%3E%0D%0A%09%09%3Cendorsement_type%3Eadditional%3C%2Fendorsement_type%3E
%0D%0A%09%09%3Cpremium%3E3.14%3C%2Fpremium%3E%0D%0A%09%09%3Cpremium_due%3E3.
14%3C%2Fpremium_due%3E%0D%0A%09%09%3Cendorsement_body%3ETest+Additional+Prem
ium+Endorsement%3C%2Fendorsement_body%3E%0D%0A%09%3C%2FAttachedEndorsements%
3E%0D%0A%09%3CAttachedEndorsements%3E%0D%0A%09%09%3Cendorsement_type%3Eretur
n%3C%2Fendorsement_type%3E%0D%0A%09%09%3Cpremium%3E3.14%3C%2Fpremium%3E%0D%0
A%09%09%3Cpremium_due%3E3.14%3C%2Fpremium_due%3E%0D%0A%09%09%3Cendorsement_b
ody%3ETest+Return+Premium+Endorsement%3C%2Fendorsement_body%3E%0D%0A%09%3C%2
FAttachedEndorsements%3E%0D%0A%3C%2FIntegrusEPLLitePolicyInterface%3E%3C%2Fs
XMLString%3E%3C%2Fns1%3APolicyInterfaceWebService%3E%3C%2FSOAP-ENV%3ABody%3E
%3C%2FSOAP-ENV%3AEnvelope%3E%0D%0A
----------------------------

With 'sXMLString' being the posted form variable and everything
else being it's value. So I determined what I needed to do was
strip out the 'sXMLString=' and urldecode the rest of it prior to
it getting passed to the soap_server::service() function. And, for
the most part, that is working allowing the data to be transferred
via regular HTTP POST or through the NuSOAP client class.

What I'm finding now is that for some reason, the soap_server::service()
function is turning the XML into an array prior to passing it to my
registered function, which is expecting it to be in XML format. The
data is in XML format when submitted to the NuSOAP server by
a NuSOAP client, but for some reason it's transforming it into an
array when submitted via HTTP post. The following is the debug
data. As you can see, when it does the "var_dump()", the data is
an array.

<!--

soap_server: entering parse_request() on 12:47 2004-04-27
soap_server: Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
soap_server: Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
soap_server: Accept-Encoding: gzip,deflate
soap_server: Accept-Language: en-us,en;q=0.5
soap_server: Connection: keep-alive
soap_server: Content-Length: 3530
soap_server: Content-Type: application/x-www-form-urlencoded
soap_server: Host: eazypro.wild.net
soap_server: Keep-Alive: 300
soap_server: Referer:
http://eazypro.wild.net/interactive/cron_scripts/test/test_soap_post.php
soap_server: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.6) Gecko/20040206 Firefox/0.8
soap_server: got character encoding: UTF-8
soap_server: parser debug:
soap_parser: Entering soap_parser(), length=2493, encoding=UTF-8
soap_parser: found root struct PolicyInterfaceWebService, pos 2
soap_parser: inside buildVal() for UserRecord(pos 5) of type
soap_parser: inside buildVal() for AttachedEndorsements(pos 30) of type
soap_parser: inside buildVal() for AttachedEndorsements(pos 35) of type
soap_parser: inside buildVal() for AttachedEndorsements(pos 40) of type
soap_parser: inside buildVal() for AttachedEndorsements(pos 45) of type
soap_parser: inside buildVal() for IntegrusEPLLitePolicyInterface(pos 4) of
type
soap_parser: inside buildVal() for sXMLString(pos 3) of type string
soap_parser: inside buildVal() for PolicyInterfaceWebService(pos 2) of type
struct
soap_parser: parsed successfully, found root struct: 2 of name
PolicyInterfaceWebService

soap_server: method name: PolicyInterfaceWebService
soap_server: calling parser->get_response()
soap_server: leaving parse_request() on 12:47 2004-04-27
soap_server: entering invoke_method
soap_server: method 'PolicyInterfaceWebService' exists
soap_server: params var dump array(1) {
["sXMLString"]=>
array(1) {
["IntegrusEPLLitePolicyInterface"]=>
array(16) {
[0]=>
array(13) {
["firstname"]=>
string(4) "Test"
["lastname"]=>
string(4) "User"
["company"]=>
string(31) "Zed Zed Webservice Test Company"
["address1"]=>
string(9) "Address 1"
["address2"]=>
string(9) "Address 2"
["city"]=>
string(4) "City"
["state"]=>
string(5) "State"
["country"]=>
string(13) "United States"
["zip"]=>
string(5) "70433"
["phone"]=>
string(10) "1231231234"
["fax"]=>
string(10) "1231231235"
["email"]=>
string(14) "chris@xxxxxxxx"
["billing_email"]=>
string(14) "chris@xxxxxxxx"
}
[1]=>
string(11) "Corporation"
[2]=>
string(6) "444220"
[3]=>
string(6) "Retail"
[4]=>
string(49) "Nurseries, Garden Centers, and Farm Supply Stores"
[5]=>
string(2) "25"
[6]=>
string(2) "10"
[7]=>
string(3) "Yes"
[8]=>
string(2) "No"
[9]=>
string(2) "No"
[10]=>
string(15) "Full Prior Acts"
[11]=>
string(2) "No"
[12]=>
array(4) {
["endorsement_type"]=>
string(10) "additional"
["premium"]=>
string(4) "3.14"
["premium_due"]=>
string(4) "3.14"
["endorsement_body"]=>
string(35) "Test Additional Premium Endorsement"
}
[13]=>
array(4) {
["endorsement_type"]=>
string(4) "text"
["premium"]=>
string(1) "0"
["premium_due"]=>
string(1) "0"
["endorsement_body"]=>
string(21) "Test Text Endorsement"
}
[14]=>
array(4) {
["endorsement_type"]=>
string(10) "additional"
["premium"]=>
string(4) "3.14"
["premium_due"]=>
string(4) "3.14"
["endorsement_body"]=>
string(35) "Test Additional Premium Endorsement"
}
[15]=>
array(4) {
["endorsement_type"]=>
string(6) "return"
["premium"]=>
string(4) "3.14"
["premium_due"]=>
string(4) "3.14"
["endorsement_body"]=>
string(31) "Test Return Premium Endorsement"
}
}
}
}

soap_server: calling 'PolicyInterfaceWebService' with params
soap_server: calling method using call_user_func_array()
soap_server: response var dumpstring(328) "<?xml version="1.0"
encoding="UTF-8"?>
<WebServiceResult>
<NewFailureMessages>
<FailureMessage>[errormessage] : Start tag expected, '<' not found
<br />
[line] : 1<br />
[col] : 1<br />
[directory] : /tmp<br />
[file] : /tmp/a0493d0c91bf3d47b9daa58575448b88.xml<br />
</FailureMessage>
</NewFailureMessages>
</WebServiceResult>
"

soap_server: leaving invoke_method: called method PolicyInterfaceWebService,
received <?xml version="1.0" encoding="UTF-8"?>
<WebServiceResult>
<NewFailureMessages>
<FailureMessage>[errormessage] : Start tag expected, '<' not found
<br />
[line] : 1<br />
[col] : 1<br />
[directory] : /tmp<br />
[file] : /tmp/a0493d0c91bf3d47b9daa58575448b88.xml<br />
</FailureMessage>
</NewFailureMessages>
</WebServiceResult>
of typestring
soap_server: Entering serialize_return
soap_server: got a(n) string from method
soap_server: serializing return value
soap_server: in serialize_val: <?xml version="1.0" encoding="UTF-8"?>
<WebServiceResult>
<NewFailureMessages>
<FailureMessage>[errormessage] : Start tag expected, '<' not found
<br />
[line] : 1<br />
[col] : 1<br />
[directory] : /tmp<br />
[file] : /tmp/a0493d0c91bf3d47b9daa58575448b88.xml<br />
</FailureMessage>
</NewFailureMessages>
</WebServiceResult>
, return, , , , , encoded
soap_server: return val: string(472) "<return xsi:type="xsd:string">&lt;?xml
version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;WebServiceResult&gt;
&lt;NewFailureMessages&gt;
&lt;FailureMessage&gt;[errormessage] : Start tag expected, &apos;&lt;&apos;
not found
&lt;br /&gt;
[line] : 1&lt;br /&gt;
[col] : 1&lt;br /&gt;
[directory] : /tmp&lt;br /&gt;
[file] : /tmp/a0493d0c91bf3d47b9daa58575448b88.xml&lt;br /&gt;
&lt;/FailureMessage&gt;
&lt;/NewFailureMessages&gt;
&lt;/WebServiceResult&gt;
</return>"

soap_server: serializing response
soap_server: Leaving serialize_return
soap_server: Enter send_response

-->

Chris




-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise