[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: SOAP. ФОрмирование xml
natalina
Добрый день! У меня такая проблема. Вот мой скрипт

ini_set('display_errors', 1);

ini_set('display_startup_errors', 1);

error_reporting(E_ALL);

$url = "https://адрес_к.wsdl";

$user_id = '454585555';

$func = 'TrCreate';

$firma = '567';

$xml = "<?xml version=\"1.0\" encoding=\"windows-1251\" ?><request></request>"; // TrCreate

$key = file_get_contents($user_id.".key");

$cert = file_get_contents($user_id.".crt");

$pkeyid = openssl_pkey_get_private($key);

//$pcertid = openssl_pkey_get_public($cert);

// compute signature


openssl_sign($xml, $signatureKey, $pkeyid);

// free the key from memory

openssl_free_key($pkeyid);

$reqbufb64 = base64_encode($signatureKey);

$signb64 = base64_encode($cert);

$client = new SoapClient($url, array(

"exceptions"=>0,"trace" => 1, "encoding" => "utf-8","cache_wsdl" => WSDL_CACHE_NONE));

$client->__soapCall('WSDLVEGA',

array(new SoapVar('

xmlns:xmm="http://namespace.softwareag.com/entirex/xml/mapping"

<SOAP-ENV:Header>

</SOAP-ENV:Header>

<SOAP-ENV:Body><m:WSDLVEGA xmlns:m="urn:com-softwareag-entirex-rpc:CSS-BASE-WSDLVEGA"><USER-ID>'
.$user_id.'</USER-ID><FUNC>'.$func.'</FUNC>

<FIRMA>'
.$firma.'</FIRMA><REQBUFB64>'.$reqbufb64.'</REQBUFB64><SIGNB64>'.$signb64.'</SIGNB64></m:WSDLVEGA>', XSD_ANYXML)),

array('soapaction' => 'WSDLVEGA'));

echo 'Запрос<br/>';

echo '<pre>'.htmlspecialchars($client->__getLastRequest()).'</pre><br/>';

echo 'Ответ<br/>';

echo htmlspecialchars($client->__getLastResponse()).'<br/>';

echo '<br/>';


После запуска, получаю следующее

Запрос

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:com-softwareag-entirex-rpc:CSS-BASE" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:WSDLVEGA>
xmlns:xmm="http://namespace.softwareag.com/entirex/xml/mapping"
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body><m:WSDLVEGA
xmlns:m="urn:com-softwareag-entirex-rpc:CSS-BASE-WSDLVEGA"><USER-ID>4256652</USER-ID><FUNC>TrCreate</FUNC>
<FIRMA>
578</FIRMA><REQBUFB64>6QxNbStEK1mqzrYWgq+8ECUnCQVNU=</REQBUFB64><SIGNB64>LS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=</SIGNB64></m:WSDLVEGA><FUNC xsi:nil="true"/><FIRMA xsi:nil="true"/><REQBUFB64 xsi:nil="true"/><SIGNB64 xsi:nil="true"/><W3VALUE xsi:nil="true"/></ns1:WSDLVEGA></SOAP-ENV:Body></SOAP-ENV:Envelope>



а хотелось бы получить такой запрос


<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xmm="http://namespace.softwareag.com/entirex/xml/mapping"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<m:WSDLVEGA
xmlns:m="urn:com-softwareag-entirex-rpc:CSS-BASE-WSDLVEGA">
<USER-ID>
454585555</USER-ID>
<FUNC>
TrCreate</FUNC>
<FIRMA>
567</FIRMA>
<REQBUFB64>
6QxNbStEK1mqzrYWgq+8ECUnCQVNU=</REQBUFB64>
<SIGNB64>
LS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=</</SIGNB64>
</m:
WSDLVEGA>
</SOAP-ENV:Body></SOAP-ENV:Envelope>



Вопрос, как такое сделать и почему в конце запроса появляются элементы с пустыми значениями.
Вот wsdl документ

<definitions name="CSS-BASE" targetNamespace="http://namespace.softwareag.com/entirex/xml/mapping"
xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://namespace.softwareag.com/entirex/xml/mapping" xmlns:sn0="urn:com-softwareag-entirex-rpc:CSS-BASE">
<types>
<xsd:schema
targetNamespace="urn:com-softwareag-entirex-rpc:CSS-BASE">
<xsd:import
namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
</xsd:schema>
</types>
<message
name="WSDLVEGA">
<part
name="USER-ID" type="xsd:string"/>
<part
name="FUNC" type="xsd:string"/>
<part
name="FIRMA" type="xsd:string"/>
<part
name="REQBUFB64" type="xsd:string"/>
<part
name="SIGNB64" type="xsd:string"/>
<part
name="W3VALUE" type="xsd:string"/>
</message>
<message
name="WSDLVEGAResponse">
<part
name="USER-ID1" type="xsd:string"/>
<part
name="FUNC1" type="xsd:string"/>
<part
name="FIRMA1" type="xsd:string"/>
<part
name="REQBUFB641" type="xsd:string"/>
<part
name="SIGNB641" type="xsd:string"/>
<part
name="W3VALUE1" type="xsd:string"/>
</message>
<portType
name="CSS-BASEPort">
<operation
name="WSDLVEGA">
<input
message="tns:WSDLVEGA"/>
<output
message="tns:WSDLVEGAResponse"/>
</operation>
</portType>
<binding
name="CSS-BASESOAP11Binding" type="tns:CSS-BASEPort">
<soap:binding
style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation
name="WSDLVEGA">
<soap:operation
soapAction="WSDLVEGA"/>
<input>
<soap:body
use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:com-softwareag-entirex-rpc:CSS-BASE"/>
</input>
<output>
<soap:body
use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:com-softwareag-entirex-rpc:CSS-BASE"/>
</output>
</operation>
</binding>
<binding
name="CSS-BASESOAP12Binding" type="tns:CSS-BASEPort">
<soap12:binding
style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation
name="WSDLVEGA">
<soap12:operation
soapAction="WSDLVEGA"/>
<input>
<soap12:body
use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:com-softwareag-entirex-rpc:CSS-BASE"/>
</input>
<output>
<soap12:body
use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:com-softwareag-entirex-rpc:CSS-BASE"/>
</output>
</operation>
</binding>
<service
name="CSS-BASE">
<port
name="CSS-BASESOAP11Port" binding="tns:CSS-BASESOAP11Binding">
<soap:address
location="https://ip:port/entirex/xmlrt"/>
</port>
<port
name="CSS-BASESOAP12Port" binding="tns:CSS-BASESOAP12Binding">
<soap12:address
location="https://ip:port/entirex/xmlrt"/>
</port>
</service>
</definitions>


Помогите пожалуйста разобраться
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.