Отправить XML с использованием SOAP

Мне нужна ваша помощь для отправки XML через SOAP в соответствии с инструкциями моего провайдера.

Проблемы:

  1. Он не генерирует полные пространства имен (Top xmlns: xsi и xmlns: xsd)
  2. Он не генерирует тип переменной для полей массива (ns1: Значение 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>

Это 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>

Я уже пробовал несколько инструментов, таких как SOAPUI и библиотека NUSOAP, и у меня тот же результат, я получаю следующую ошибку:

Введите «System.Xml.XmlNode» в сборке «System.Xml, версия = 4.0.0.0, культура = нейтральная, PublicKeyToken = b77a5c561934e089» не помечена как сериализуемая.

Поставщик говорит мне, что это из-за двух проблем, которые я упомянул выше.

1

Решение

Нашел решение в другом источнике, публикация на случай, если кто-то его обслуживал

Добавить объект 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"));
0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector