WSDL SoapClient and PHP + own Namespace

时间:2022-07-17 11:01:11

I've tried for a while to get this SoapRequest but i'm failed:

我已经尝试了一段时间来获得这个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>

I have to write it in PHP. The questions are:

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

how to change the Namespace? how to change the soap tag? thank you in advice for help!

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

1 个解决方案

#1


0  

I often use the NuSOAP library for these kind of requests. I have included a piece of sample code below, does it help you?

我经常使用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');

#1


0  

I often use the NuSOAP library for these kind of requests. I have included a piece of sample code below, does it help you?

我经常使用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');