3

我已经尝试了一段时间来获得这个 SoapRequest 但我失败了:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" >
  <soap:Body xmlns:gog="http://www.test.nms">
    <gog:GenerateRequest>
      <gog:Application>TestApp</gog:Application>
      <gog:User>TestUser</gog:User>
      <gog: RequestCreateOnly>
        <gog:Count>1</gog:Count>
        <gog:Subject>Test</gog:Subject>
      </gog: RequestCreateOnly>
    </gog:GenerateRequest>
  </soap:Body>
</soap:Envelope>

我必须用 PHP 编写它。问题是:

如何更改命名空间?如何更改肥皂标签?谢谢你的建议帮助!

4

1 回答 1

0

我经常将 NuSOAP 库用于此类请求。我在下面包含了一段示例代码,它对您有帮助吗?

require_once('path-to-nusoap/nusoap.php');

$client = new nusoap_client("http://www.mywebservicehere.com", 'wsdl');
$client -> setDefaultRpcParams(true);
$client -> useHTTPPersistentConnection();
$client -> soap_defencoding = 'UTF-8';
$client -> setUseCurl(true);

$request = '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                <soap:Body xmlns:gog="http://www.test.nms">
                    <gog:GenerateRequest>
                        <gog:Application>TestApp</gog:Application>
                        <gog:User>TestUser</gog:User>
                        <gog: RequestCreateOnly>
                            <gog:Count>1</gog:Count>
                            <gog:Subject>Test</gog:Subject>
                        </gog: RequestCreateOnly>
                    </gog:GenerateRequest>
                </soap:Body>
            </soap:Envelope>';

$results = $client->send($request,'http://www.actionurlhere.com');
于 2014-10-22T07:46:37.700 回答