如何从PHP向JAX-WS webservice发送Soap请求?

时间:2014-08-16 05:56:36

标签: java php soap

我正在尝试使用__getLastRequest()获取XML请求,如下所示但是失败了,请帮助

<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">
     <soapenv:Header/>
     <soapenv:Body>
    <ord:getOrderDocuments>
        <request>
            <hl7Order>IvRmxhdGVEZWNvZGU+PnN0cmVhbQp4nbPbOQ. . . Base64-encoded content truncated
            </hl7Order>
            <orderSupportRequests>
                <requestType>ABN</requestType>
                <requestType>REQ</requestType>
            </orderSupportRequests>
        </request>
    </ord:getOrderDocuments>
    </soapenv:Body>
    </soapenv:Envelope>

如何发送此SOAP请求并使用PHP获取响应?

1 个答案:

答案 0 :(得分:0)

您可以在此处查看PHP WSDL客户端的文档: http://php.net/manual/en/book.soap.php

$service_url ="my url";
$client = new SoapClient($service_url,array('cache_wsdl' => WSDL_CACHE_NONE));
    $response = $client->ord:getOrderDocuments(array (
        "hl7Order" => "IvRmxhdGVEZWNvZGU...",
        //..... other args
    ));

//fetch response        
$output =$response->return;