使用SOAP-PHP发送XML

使用SOAP-PHP发送XML,php,xml,soap,wsdl,Php,Xml,Soap,Wsdl,我需要您的帮助,根据我的提供商的指示,通过SOAP发送XML 问题: 它不生成完整的名称空间(最前面的xmlns:xsi和xmlns:xsd) 它不会为数组字段生成变量类型(ns1:Value xsi:type=“xsd:string”) 这是我的代码和生成我的XML $WebService = new SoapClient('https:url.asmx?wsdl', array( 'trace' => 1 ) ); $dateClient["PSEHostingField"][0]

我需要您的帮助,根据我的提供商的指示,通过SOAP发送XML

问题:

  • 它不生成完整的名称空间(最前面的xmlns:xsi和xmlns:xsd)
  • 它不会为数组字段生成变量类型(ns1:Value xsi:type=“xsd:string”)
  • 这是我的代码和生成我的XML

    $WebService = new SoapClient('https:url.asmx?wsdl', array( 'trace' => 1 ) );
    
    $dateClient["PSEHostingField"][0] = array("Name"=>"id_client","Value"=>"123456789");
    $dateClient["PSEHostingField"][1] = array("Name"=>"name_client","Value"=>"Daniel");
    $dateClient["PSEHostingField"][2] = array("Name"=>"tel_client","Value"=>"123456");
    
    $params = array(
        "ticketOfficeID" => 2259, 
        "amount" => 291944,
        "vatAmount" => 5444,
        "paymentID" => 9561,
        "paymentDescription" => PAGOS PSE,
        "referenceNumber1" => 10.10.10.244,
        "referenceNumber2" => NIT,
        "referenceNumber3" => 900000000,
        "serviceCode" => 5001,
        "email" => correocliente@gmail.com,
        "fields" => $dateClient,
        "entity_url" => "http:urlRespoce.php",
    );
    
    $Responce = $WebService->createTransactionPaymentHosting( $params );
    
    这就是让我感到困惑的XML

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:ns1="http://www.achcolombia.com.co/PSEHostingWS">
        <SOAP-ENV:Body>
            <ns1:createTransactionPaymentHosting>
                <ns1:ticketOfficeID>2259</ns1:ticketOfficeID>
                <ns1:amount>291944</ns1:amount>
                <ns1:vatAmount>5444</ns1:vatAmount>
                <ns1:paymentID>9561</ns1:paymentID>
                <ns1:paymentDescription>PAGOS PSE</ns1:paymentDescription>
                <ns1:referenceNumber1>10.10.10.244</ns1:referenceNumber1>
                <ns1:referenceNumber2>NIT</ns1:referenceNumber2>
                <ns1:referenceNumber3>900000000</ns1:referenceNumber3>
                <ns1:serviceCode>5001</ns1:serviceCode>
                <ns1:email>correocliente@gmail.com</ns1:email>
                <ns1:fields>
                    <ns1:PSEHostingField>
                        <ns1:Name>id_client</ns1:Name>
                        <ns1:Value>123456789</ns1:Value>
                    </ns1:PSEHostingField>
                    <ns1:PSEHostingField>
                        <ns1:Name>name_client</ns1:Name>
                        <ns1:Value>Daniel</ns1:Value>
                    </ns1:PSEHostingField>
                    <ns1:PSEHostingField>
                        <ns1:Name>tel_client</ns1:Name>
                        <ns1:Value>123456</ns1:Value>
                    </ns1:PSEHostingField>
                </ns1:fields>
                <ns1:entity_url>http:urlResponce.php</ns1:entity_url>
            </ns1:createTransactionPaymentHosting>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    
    
    2259
    291944
    5444
    9561
    帕戈斯PSE
    10.10.10.244
    尼特
    900000000
    5001
    correocliente@gmail.com
    id_客户端
    123456789
    客户名称
    丹尼尔
    电话客户
    123456
    http:urresponse.php
    
    这是我应该发送的XML

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:ns1="http://www.achcolombia.com.co/PSEHostingWS">
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <SOAP-ENV:Body>
            <ns1:createTransactionPaymentHosting>
                <ns1:ticketOfficeID>2259</ns1:ticketOfficeID>
                <ns1:amount>291944</ns1:amount>
                <ns1:vatAmount>5444</ns1:vatAmount>
                <ns1:paymentID>9561</ns1:paymentID>
                <ns1:paymentDescription>PAGOS PSE</ns1:paymentDescription>
                <ns1:referenceNumber1>10.10.10.244</ns1:referenceNumber1>
                <ns1:referenceNumber2>NIT</ns1:referenceNumber2>
                <ns1:referenceNumber3>900000000</ns1:referenceNumber3>
                <ns1:serviceCode>5001</ns1:serviceCode>
                <ns1:email>correocliente@gmail.com</ns1:email>
                <ns1:fields>
                    <ns1:PSEHostingField>
                        <ns1:Name>id_client</ns1:Name>
                        <ns1:Value xsi:type="xsd:string">123456789</ns1:Value>
                    </ns1:PSEHostingField>
                    <ns1:PSEHostingField>
                        <ns1:Name>name_client</ns1:Name>
                        <ns1:Value xsi:type="xsd:string">Daniel</ns1:Value>
                    </ns1:PSEHostingField>
                    <ns1:PSEHostingField>
                        <ns1:Name>tel_client</ns1:Name>
                        <ns1:Value xsi:type="xsd:string">123456</ns1:Value>
                    </ns1:PSEHostingField>
                </ns1:fields>
                <ns1:entity_url>http:urlResponce.php</ns1:entity_url>
            </ns1:createTransactionPaymentHosting>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    
    
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd=”http://www.w3.org/2001/XMLSchema">
    2259
    291944
    5444
    9561
    帕戈斯PSE
    10.10.10.244
    尼特
    900000000
    5001
    correocliente@gmail.com
    id_客户端
    123456789
    客户名称
    丹尼尔
    电话客户
    123456
    http:urresponse.php
    
    我已经尝试了一些工具,如SOAPUI和NUSOAP库,我得到了相同的结果,我得到了以下错误:

    程序集“System.Xml,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”中的类型“System.Xml.XmlNode”未标记为可序列化


    提供商告诉我,这是因为我上面提到的两个问题。

    在另一个来源中找到了解决方案,即出版物,以防它为某人服务

    添加SoapVar对象

    $datosCliente["PSEHostingField"][0] = array("Name"=>"id_client","Value"=>new SoapVar("123456789", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema"));
    $datosCliente["PSEHostingField"][1] = array("Name"=>"name_client","Value"=>new SoapVar("Daniel", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema"));
    $datosCliente["PSEHostingField"][2] = array("Name"=>"tel_client","Value"=>new SoapVar("123456", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema"));
    

    在另一个来源,出版物中找到了解决方案,以防它为某人服务

    添加SoapVar对象

    $datosCliente["PSEHostingField"][0] = array("Name"=>"id_client","Value"=>new SoapVar("123456789", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema"));
    $datosCliente["PSEHostingField"][1] = array("Name"=>"name_client","Value"=>new SoapVar("Daniel", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema"));
    $datosCliente["PSEHostingField"][2] = array("Name"=>"tel_client","Value"=>new SoapVar("123456", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema"));