dpt62283 2016-01-27 12:44
浏览 34

Soap PHP:双XML标签

Hye

I'm trying to use a WebService with SOAP in PHP. But the SoapVar creates my DOM XML with double XML tag

My code :

$xmlContent = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:com="http://schemas.datacontract.org/2004/07/Commun.Metier">
<soapenv:Header/>
<soapenv:Body>
    <tem:SendData> ....';
$soapClient = new SoapClient("URL OF THE WSDL", array('trace' => 1, 'location' => 'URL OF THE SERVICE', 'uri' => 'URL OF THE SERVICE'));
$myXML = new SoapVar($xmlContent, XSD_ANYXML);

try {
        $result = $soapClient->__soapCall("SendData", array('SendData' => $myXML));
    } catch (Exception $e) {
        var_dump($e);
    }

The problem is that I have an exception Bad request because the XML I'm sending haves 2 XML tags and Soap Enveloppe :

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
<SOAP-ENV:Body><?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:com="http://schemas.datacontract.org/2004/07/Commun.Metier">
<soapenv:Header/>
<soapenv:Body>
    <tem:SendData>

How can I cancel this double tag ?

Thanks

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 画两个图 python或R
    • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
    • ¥15 八路抢答器设计出现故障
    • ¥15 opencv 无法读取视频
    • ¥15 用matlab 实现通信仿真
    • ¥15 按键修改电子时钟,C51单片机
    • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
    • ¥20 5037端口被adb自己占了
    • ¥15 python:excel数据写入多个对应word文档
    • ¥60 全一数分解素因子和素数循环节位数