我有一条用PHP创建的XML消息,然后通过CURL发送:
$xml_data ="<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ord=\"http://medplus.com/orders\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">
";
$xml_data .="<soapenv:Header/>";
$xml_data .="<soapenv:Body>";
$xml_data .="<ord:getOrderDocuments soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">";
$xml_data .="<request xsi:type=\"java:OrderSupportServiceRequest\" xmlns:java=\"java:com.medplus.serviceHub.orders.webservice\">";
$xml_data .="<hl7Order xsi:type=\"xsd:base64Binary\">$HL7</hl7Order>";
$xml_data .="<orderSupportRequests xsi:type=\"java1:ArrayOfString\" soapenc:arrayType=\"xsd:string[]\" xmlns:java1=\"java:language_builtins.lang\">ABN</orderSupportRequests>";
$xml_data .="</request>";
$xml_data .="</ord:getOrderDocuments>";
$xml_data .="</soapenv:Body>";
$xml_data .="</soapenv:Envelope>";
我需要能够'#34;填充&#34; orderSupportRequests有2个值&#34; ABN&#34;和&#34; REQ&#34;
我如何将其写入上面的XML消息?
谢谢!
NCoder
答案 0 :(得分:1)
您已将orderSupportRequests
声明为字符串数组。
你必须用另一个标签包裹孩子。
<orderSupportRequests
xsi:type="java1:ArrayOfString"
soapenc:arrayType="xsd:string[2]"
xmlns:java1="java:language_builtins.lang">
<item xsi:type="xsd:string">ABN</item>
<item xsi:type="xsd:string">REQ</item>
</orderSupportRequests>