PHP calls C # Webservice to pass array parameters. POST/xxxxxxxxxxxx/ws/commonservice. asmx HTTP/1.1
Host: 202.82.66.147
Content-Type: text/xml; charset = utf-8
Content-Length: length
SOAPAction: "http: // xxxxxxxxxxxxxx/webservices/queryVoyageRoute_onWeb"
String
String
String
String
String
String
Bytes ---------------------------------------------------------------------------------------
Return value:
HTTP/1.1 200 OK
Content-Type: text/xml; charset = utf-8
Content-Length: length
Schema Xml
Bytes -----------------------------------------------------------------------------------
Soap_defencoding = 'utf-8'; $ client-> decode_utf8 = false; $ client-> xml_encoding = 'utf-8'; $ setoffdate = array (0 => "setoffdate ", 1 => "2014-02-10"); $ fromportcode = array (0 => "fromportcode", 1 => "SK"); $ toportcode = array (0 => "toportcode ", 1 => "ZH"); $ parameters = array (0 => $ setoffdate, 1 => $ fromportcode, 2 => $ toportcode ); $ param = array (0 => $ parameters, 1 => "SKG", 2 => "E"); // $ param ["param1"] = "01 "; // $ param ["param2"] = "02"; // $ resu Lt = $ client->__ soapCall ("GetArticle", array ($ param); $ result = $ client->__ Call ("queryVoyageRoute_onWeb ", array ($ param); if (is_soap_fault ($ result) {trigger_error ("SOAP Fault: (faultcode: {$ result-> faultcode}, faultstring: {$ result-> faultstring}) ", E_USER_ERROR);} else {$ data = $ result-> queryVoyageRoute_onWebResult; // class is returned here, you must use-> to obtain the value of the element print_r ($ data); // $ city_xml = simplexml_load_string ($ ci Ty) ;}?>
Error message:
Notice: Undefined property: stdClass: $ queryVoyageRoute_onWebResult in D: \ xampp \ htdocs \ WS \ index. php on line 21
How do I pass the parameter in the past? How can this problem be passed in?
Reply to discussion (solution)
Check whether queryVoyageRoute_onWebResult is spelled incorrectly.
Right:
Print_r ($ result); check the result.
If the result does not contain the expected content
Check whether the passed parameters are correct.
Since you do not see your WSDL, you do not know how to write the correct parameter
The parameter should be an associated array (the associated key is WSDL), which may be multidimensional.
And you have a multi-dimensional subscript array.
I have done it. just add the parameter name.
$param = array('parameters'=>$parameters,'portcompanyCode'=>"SKG",'lang'=>"C");
But how can we know what encoding he uses when a piece of garbled text is called in Chinese?
??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) JLFZ ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) SJCD ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) XYLC ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) SKWEB ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) AYGJ ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) SHYG ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) BZLY ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) LHMT ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) STSJD ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) QSHK ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) KBSJ ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) YGJD ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) WYN ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) HGJD ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) TGGY ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) ZNHY ??? WHY ??? Dashboard? Bed ready? SKZH used? ?? KKJ2014-02-10 07: 30MSK-ZH ????? (65) question ???? (27 )????? (0) Lu ??? (12) MHZX
SOAP, of course, is UTF-8.
Flight information?
SOAP, of course, is UTF-8.
Flight information?
$ Client-> xml_encoding = 'utf-8 ';
Didn't xml_encoding = 'utf-8' already exist? Why is it garbled?
SOAP, of course, is UTF-8.
Flight information?
Please delete the version. thank you.
header("content-type:text/html;charset=utf-8");
Yes, it's UTF-8.
When gbk is displayed, it is garbled.
Yes, it's UTF-8.
When gbk is displayed, it is garbled.
Moderator, please check again. why, I think the table values of some columns in print_r cannot work? All are SimpleXMLElement Object ()
One more.
print_r($child->toport).;
All objects loaded with simplexml_load_string are SimpleXMLElement objects.
The specific analysis depends on the specific data.
You can post $ result and describe the requirement
Page result:
Shekou Port? Zi passenger terminal SKMAC Venus JX2014-02-10 09: 30MSK-MAC ordinary bit (28) first class (5) special bit (8) SKG Shekou Port? Zi passenger terminal SKMAC Venus JX2014-02-10 09: 30MSK-MAC ordinary bit (28) first class (5) special bit (8) XYLC Shekou Port? Zi passenger terminal SKMAC Venus JX2014-02-10 09: 30MSK-MAC ordinary bit (28) first class (5) special bit (8) SHYG Shekou Port? Zi passenger terminal SKMAC Venus JX2014-02-10 09: 30MSK-MAC ordinary bit (28) first class (5) special bit (8) SJCD Shekou Port? Zi passenger terminal SKMAC Venus JX2014-02-10 09: 30MSK-MAC ordinary bit (28) first class (5) special bit (8) BAKY Shekou Port? Zi passenger terminal SKMAC Venus JX2014-02-10 09: 30MSK-MAC ordinary bit (28) first class (5) special bit (8) ZYJD Shekou Port? Zi passenger terminal SKMAC Venus JX2014-02-10 09: 30MSK-MAC ordinary bit (28) first class (5) special bit (8) YJGY
Result Source File:
Shekou Port
? Zi passenger terminal
SK
MAC
Venus
JX
M
SK-MAC
Ordinary (28) first class (5) Special (8)
SKG
Shekou Port
? Zi passenger terminal
SK
MAC
Venus
JX
M
SK-MAC
Ordinary (28) first class (5) Special (8)
XYLC
Shekou Port
? Zi passenger terminal
SK
MAC
Venus
JX
M
SK-MAC
Ordinary (42) first class (31) Special (0)
YJGY
Shekou Port
? Zi passenger terminal
SK
MAC
Xunlong 5
XL5
M
SK-MAC
Ordinary (42) first class (31) Special (0)
SKXRD
Shekou Port
? Zi passenger terminal
SK
MAC
Xunlong 5
XL5
M
SK-MAC
Ordinary (148) first class (7) Special (8)
SCP
All objects loaded with simplexml_load_string are SimpleXMLElement objects.
The specific analysis depends on the specific data.
You can post $ result and describe the requirement
I only want the field information of print_r: FROMPORT, TOPORT, and SETOFFTIME.
$key = array('FROMPORT', 'TOPORT', 'SETOFFTIME');foreach($obj_xml->NewDataSet->Table as $item) { foreach($key as $k) { $t[$k] = strval($item->$k); } $res[] = $t;}print_r($res);
Array ([0] => Array ([FROMPORT] => Shekou Port [TOPORT] =>? Zi passenger terminal [SETOFFTIME] =>) [1] => Array ([FROMPORT] => Shekou Port [TOPORT] =>? Zi passenger terminal [SETOFFTIME] =>) [2] => Array ([FROMPORT] => Shekou Port [TOPORT] =>? Zi passenger terminal [SETOFFTIME] =>) [3] => Array ([FROMPORT] => Shekou Port [TOPORT] =>? Zi passenger terminal [SETOFFTIME] =>) [4] => Array ([FROMPORT] => Shekou Port [TOPORT] =>? [SETOFFTIME] => ))
$key = array('FROMPORT', 'TOPORT', 'SETOFFTIME');foreach($obj_xml->NewDataSet->Table as $item) { foreach($key as $k) { $t[$k] = strval($item->$k); } $res[] = $t;}print_r($res);
Array ([0] => Array ([FROMPORT] => Shekou Port [TOPORT] =>? Zi passenger terminal [SETOFFTIME] =>) [1] => Array ([FROMPORT] => Shekou Port [TOPORT] =>? Zi passenger terminal [SETOFFTIME] =>) [2] => Array ([FROMPORT] => Shekou Port [TOPORT] =>? Zi passenger terminal [SETOFFTIME] =>) [3] => Array ([FROMPORT] => Shekou Port [TOPORT] =>? Zi passenger terminal [SETOFFTIME] =>) [4] => Array ([FROMPORT] => Shekou Port [TOPORT] =>? [SETOFFTIME] => ))
Thank you, moderator. please delete the reply from the eighth floor. I will close the post later.