PHP 对 navision 网络服务的 SOAP 请求
PHP SOAP request to navision webservice
几天来,我一直在努力在 PHP 网店和具有 NTLM 身份验证的 navision 服务器之间建立连接。现在连接和身份验证已完成,我在执行正确请求时遇到了问题。
对于这个例子,我尝试使用一个函数 (ItemPriceDiscInventory) 来检索价格信息。
我从客户那里得到的 url 是:http://IP:PORT/MSIteminfoTest/WS/Saniceve%20BV/Codeunit/ItemPriceDiscInventory
我尝试了两种方法来发出请求:
curl post 与原始 XML
原始XML由客户提供。这与输入(本地)WSDL 文件时测试程序 (SOACleaner) 给我的 XML 相同。
$request = '
<InputItemPriceDiscInventory_PortGetPriceDiscInvInformation xmlns="http://xyrow.com">
<Body xmlns="">
<GetPriceDiscInvInformation xmlns="urn:microsoft-dynamics-schemas/codeunit/ItemPriceDiscInventory">
<itemPriceDiscInventory>
<Item xmlns="urn:microsoft-dynamics-nav/xmlports/x50005">
<Klantnummer />
<Artikelnr />
<Aantal />
<KortingsPercentage1 />
<KortingsPercentage2 />
<NettoPerEenheid />
<BeschikbareVoorraad />
<WebShopVoorraad />
</Item>
</itemPriceDiscInventory>
<customerNo>1234</customerNo>
<itemNo>5678</itemNo>
<quantityVarDec>1</quantityVarDec>
</GetPriceDiscInvInformation>
</Body>
</InputItemPriceDiscInventory_PortGetPriceDiscInvInformation>';
我的要求:
$ch = curl_init();
$headers = array(
'Method: POST',
'Connection: Keep-Alive',
'Content-Type: text/xml; charset=utf-8',
"Host: {$ip}:{$port}",
"Accept: */*"
);
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_USERPWD, 'usr:pass');
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM );
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
这个 returns WSDL 文件,无论我包含什么 POST 值。如果我包含 header 'SOAPAction: "ItemPriceDiscInventory"'
它会给我错误:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">a:System.Net.WebException</faultcode><faultstring xml:lang="nl-NL">Soap message is invalid!</faultstring><detail><string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Soap message is invalid!</string></detail></s:Fault></s:Body></s:Envelope>
WSDL 看起来像:
<definitions targetNamespace="urn:microsoft-dynamics-schemas/codeunit/ItemPriceDiscInventory" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:microsoft-dynamics-schemas/codeunit/ItemPriceDiscInventory">
<types>
<schema elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-nav/xmlports/x50005" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:microsoft-dynamics-nav/xmlports/x50005">
<complexType name="Item">
<sequence>
<element minOccurs="1" maxOccurs="1" name="Klantnummer" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Artikelnr" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Aantal" type="string"/>
<element minOccurs="1" maxOccurs="1" name="KortingsPercentage1" type="string"/>
<element minOccurs="1" maxOccurs="1" name="KortingsPercentage2" type="string"/>
<element minOccurs="1" maxOccurs="1" name="NettoPerEenheid" type="string"/>
<element minOccurs="1" maxOccurs="1" name="BeschikbareVoorraad" type="string"/>
<element minOccurs="1" maxOccurs="1" name="WebShopVoorraad" type="string"/>
</sequence>
</complexType>
<complexType name="ItemPriceDiscInvInfo" mixed="true">
<sequence>
<element minOccurs="1" maxOccurs="1" name="Item" type="tns:Item"/>
</sequence>
</complexType>
<element name="ItemPriceDiscInvInfo" type="tns:ItemPriceDiscInvInfo"/>
</schema>
<schema elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/ItemPriceDiscInventory" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="GetPriceDiscInvInformation">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="itemPriceDiscInventory" type="q1:ItemPriceDiscInvInfo" xmlns:q1="urn:microsoft-dynamics-nav/xmlports/x50005"/>
<element minOccurs="1" maxOccurs="1" name="customerNo" type="string"/>
<element minOccurs="1" maxOccurs="1" name="itemNo" type="string"/>
<element minOccurs="1" maxOccurs="1" name="quantityVarDec" type="decimal"/>
</sequence>
</complexType>
</element>
<element name="GetPriceDiscInvInformation_Result">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="itemPriceDiscInventory" type="q2:ItemPriceDiscInvInfo" xmlns:q2="urn:microsoft-dynamics-nav/xmlports/x50005"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="GetPriceDiscInvInformation">
<part name="parameters" element="tns:GetPriceDiscInvInformation"/>
</message>
<message name="GetPriceDiscInvInformation_Result">
<part name="parameters" element="tns:GetPriceDiscInvInformation_Result"/>
</message>
<portType name="ItemPriceDiscInventory_Port">
<operation name="GetPriceDiscInvInformation">
<input name="GetPriceDiscInvInformation" message="tns:GetPriceDiscInvInformation"/>
<output name="GetPriceDiscInvInformation_Result" message="tns:GetPriceDiscInvInformation_Result"/>
</operation>
</portType>
<binding name="ItemPriceDiscInventory_Binding" type="tns:ItemPriceDiscInventory_Port">
<binding transport="http://schemas.xmlsoap.org/soap/http" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
<operation name="GetPriceDiscInvInformation">
<operation soapAction="urn:microsoft-dynamics-schemas/codeunit/ItemPriceDiscInventory:GetPriceDiscInvInformation" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
<input name="GetPriceDiscInvInformation">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
</input>
<output name="GetPriceDiscInvInformation_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
</output>
</operation>
</binding>
<service name="ItemPriceDiscInventory">
<port name="ItemPriceDiscInventory_Port" binding="tns:ItemPriceDiscInventory_Binding">
<address location="http://IP:PORT/MSIteminfoTest/WS/Saniceve%20BV/Codeunit/ItemPriceDiscInventory" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
</port>
</service>
</definitions>
PHP SoapClient 请求
好吧,我想,试试 PHP 的 SOAP 功能。我使用了 NTLMSoapClient class 进行身份验证,这似乎没问题。
如果我用WSDL方式构建客户端,用上面给出的URL,它无法解析WSDL:
[WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'URL' : Start tag expected, '<'
但如果我在非 WSDL 模式下执行此操作,并在参数中给出位置,我会得到一些结果...
stream_wrapper_unregister('http');
stream_wrapper_register('http', 'MyServiceProviderNTLMStream') or die("Failed to register protocol");
$client = new MyServiceNTLMSoapClient(null,array( 'location' => $url,
'uri' => "http://schemas.xmlsoap.org/wsdl/soap/",
'trace' => 1));
$itemPriceDiscInventory = array(
"Item" => array(
"Klantnummer" => null,
"Artikelnr" => null,
"Aantal" => null,
"KortingsPercentage" => null,
"NettoPerEenheid" => null,
"Voorraad" => null
)
);
$params = array(
"itemPriceDiscInventory" => $itemPriceDiscInventory,
"customerNo" => '0000265',
"itemNo" => 'SAN483539',
"quantityVarDec" => '1.0'
);
echo $client->GetPriceDiscInvInformation($params);
stream_wrapper_restore('http');
这会导致错误。如果我收到最后的请求和响应,它会给我:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://xml.apache.org/xml-soap" 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:GetPriceDiscInvInformation>
<param0 xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">itemPriceDiscInventory</key>
<value xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">Item</key>
<value xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">Klantnummer</key>
<value xsi:nil="true"/>
</item>
<item>
<key xsi:type="xsd:string">Artikelnr</key>
<value xsi:nil="true"/>
</item>
<item>
<key xsi:type="xsd:string">Aantal</key>
<value xsi:nil="true"/>
</item>
<item>
<key xsi:type="xsd:string">KortingsPercentage</key>
<value xsi:nil="true"/>
</item>
<item>
<key xsi:type="xsd:string">NettoPerEenheid</key>
<value xsi:nil="true"/>
</item>
<item>
<key xsi:type="xsd:string">Voorraad</key>
<value xsi:nil="true"/>
</item>
</value>
</item>
</value>
</item>
<item>
<key xsi:type="xsd:string">customerNo</key>
<value xsi:type="xsd:string">0000265</value>
</item>
<item>
<key xsi:type="xsd:string">itemNo</key>
<value xsi:type="xsd:string">SAN483539</value>
</item>
<item>
<key xsi:type="xsd:string">quantityVarDec</key>
<value xsi:type="xsd:string">1.0</value>
</item>
</param0>
</ns1:GetPriceDiscInvInformation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
回复:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">a:Microsoft.Dynamics.Nav.Service.WebServices.ServiceBrokerException</faultcode>
<faultstring xml:lang="nl-NL">Parameter itemPriceDiscInventory in method GetPriceDiscInvInformation in service ItemPriceDiscInventory is null!</faultstring>
<detail>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Parameter itemPriceDiscInventory in method GetPriceDiscInvInformation in service ItemPriceDiscInventory is null!</string>
</detail>
</s:Fault>
</s:Body>
所以,看起来他正在尝试解析它,但是请求的格式不正确。注意:我不知道 uri 参数必须是什么。这是我可以从 WSDL 中读取的内容吗?
如果我看一下客户给我的请求和 SOAP 请求,它有很大的不同(第一个看起来根本不像 SOAP),但是对于 SOAP 请求,似乎是我再靠近一点。
对此有什么想法吗?
我终于明白了。首先我认为我的请求中的命名空间有问题。
我把WSDL文件保存在自己的服务器上,以WSDL方式用于soapclient,以navision服务器为位置。这奏效了!
我不知道为什么我不能在 WSDL 模式下使用直接 URL,但这是一个可以接受的解决方法。
几天来,我一直在努力在 PHP 网店和具有 NTLM 身份验证的 navision 服务器之间建立连接。现在连接和身份验证已完成,我在执行正确请求时遇到了问题。
对于这个例子,我尝试使用一个函数 (ItemPriceDiscInventory) 来检索价格信息。
我从客户那里得到的 url 是:http://IP:PORT/MSIteminfoTest/WS/Saniceve%20BV/Codeunit/ItemPriceDiscInventory
我尝试了两种方法来发出请求:
curl post 与原始 XML
原始XML由客户提供。这与输入(本地)WSDL 文件时测试程序 (SOACleaner) 给我的 XML 相同。
$request = '
<InputItemPriceDiscInventory_PortGetPriceDiscInvInformation xmlns="http://xyrow.com">
<Body xmlns="">
<GetPriceDiscInvInformation xmlns="urn:microsoft-dynamics-schemas/codeunit/ItemPriceDiscInventory">
<itemPriceDiscInventory>
<Item xmlns="urn:microsoft-dynamics-nav/xmlports/x50005">
<Klantnummer />
<Artikelnr />
<Aantal />
<KortingsPercentage1 />
<KortingsPercentage2 />
<NettoPerEenheid />
<BeschikbareVoorraad />
<WebShopVoorraad />
</Item>
</itemPriceDiscInventory>
<customerNo>1234</customerNo>
<itemNo>5678</itemNo>
<quantityVarDec>1</quantityVarDec>
</GetPriceDiscInvInformation>
</Body>
</InputItemPriceDiscInventory_PortGetPriceDiscInvInformation>';
我的要求:
$ch = curl_init();
$headers = array(
'Method: POST',
'Connection: Keep-Alive',
'Content-Type: text/xml; charset=utf-8',
"Host: {$ip}:{$port}",
"Accept: */*"
);
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_USERPWD, 'usr:pass');
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM );
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
这个 returns WSDL 文件,无论我包含什么 POST 值。如果我包含 header 'SOAPAction: "ItemPriceDiscInventory"'
它会给我错误:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">a:System.Net.WebException</faultcode><faultstring xml:lang="nl-NL">Soap message is invalid!</faultstring><detail><string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Soap message is invalid!</string></detail></s:Fault></s:Body></s:Envelope>
WSDL 看起来像:
<definitions targetNamespace="urn:microsoft-dynamics-schemas/codeunit/ItemPriceDiscInventory" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:microsoft-dynamics-schemas/codeunit/ItemPriceDiscInventory">
<types>
<schema elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-nav/xmlports/x50005" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:microsoft-dynamics-nav/xmlports/x50005">
<complexType name="Item">
<sequence>
<element minOccurs="1" maxOccurs="1" name="Klantnummer" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Artikelnr" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Aantal" type="string"/>
<element minOccurs="1" maxOccurs="1" name="KortingsPercentage1" type="string"/>
<element minOccurs="1" maxOccurs="1" name="KortingsPercentage2" type="string"/>
<element minOccurs="1" maxOccurs="1" name="NettoPerEenheid" type="string"/>
<element minOccurs="1" maxOccurs="1" name="BeschikbareVoorraad" type="string"/>
<element minOccurs="1" maxOccurs="1" name="WebShopVoorraad" type="string"/>
</sequence>
</complexType>
<complexType name="ItemPriceDiscInvInfo" mixed="true">
<sequence>
<element minOccurs="1" maxOccurs="1" name="Item" type="tns:Item"/>
</sequence>
</complexType>
<element name="ItemPriceDiscInvInfo" type="tns:ItemPriceDiscInvInfo"/>
</schema>
<schema elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/ItemPriceDiscInventory" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="GetPriceDiscInvInformation">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="itemPriceDiscInventory" type="q1:ItemPriceDiscInvInfo" xmlns:q1="urn:microsoft-dynamics-nav/xmlports/x50005"/>
<element minOccurs="1" maxOccurs="1" name="customerNo" type="string"/>
<element minOccurs="1" maxOccurs="1" name="itemNo" type="string"/>
<element minOccurs="1" maxOccurs="1" name="quantityVarDec" type="decimal"/>
</sequence>
</complexType>
</element>
<element name="GetPriceDiscInvInformation_Result">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="itemPriceDiscInventory" type="q2:ItemPriceDiscInvInfo" xmlns:q2="urn:microsoft-dynamics-nav/xmlports/x50005"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="GetPriceDiscInvInformation">
<part name="parameters" element="tns:GetPriceDiscInvInformation"/>
</message>
<message name="GetPriceDiscInvInformation_Result">
<part name="parameters" element="tns:GetPriceDiscInvInformation_Result"/>
</message>
<portType name="ItemPriceDiscInventory_Port">
<operation name="GetPriceDiscInvInformation">
<input name="GetPriceDiscInvInformation" message="tns:GetPriceDiscInvInformation"/>
<output name="GetPriceDiscInvInformation_Result" message="tns:GetPriceDiscInvInformation_Result"/>
</operation>
</portType>
<binding name="ItemPriceDiscInventory_Binding" type="tns:ItemPriceDiscInventory_Port">
<binding transport="http://schemas.xmlsoap.org/soap/http" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
<operation name="GetPriceDiscInvInformation">
<operation soapAction="urn:microsoft-dynamics-schemas/codeunit/ItemPriceDiscInventory:GetPriceDiscInvInformation" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
<input name="GetPriceDiscInvInformation">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
</input>
<output name="GetPriceDiscInvInformation_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
</output>
</operation>
</binding>
<service name="ItemPriceDiscInventory">
<port name="ItemPriceDiscInventory_Port" binding="tns:ItemPriceDiscInventory_Binding">
<address location="http://IP:PORT/MSIteminfoTest/WS/Saniceve%20BV/Codeunit/ItemPriceDiscInventory" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
</port>
</service>
</definitions>
PHP SoapClient 请求
好吧,我想,试试 PHP 的 SOAP 功能。我使用了 NTLMSoapClient class 进行身份验证,这似乎没问题。 如果我用WSDL方式构建客户端,用上面给出的URL,它无法解析WSDL:
[WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'URL' : Start tag expected, '<'
但如果我在非 WSDL 模式下执行此操作,并在参数中给出位置,我会得到一些结果...
stream_wrapper_unregister('http');
stream_wrapper_register('http', 'MyServiceProviderNTLMStream') or die("Failed to register protocol");
$client = new MyServiceNTLMSoapClient(null,array( 'location' => $url,
'uri' => "http://schemas.xmlsoap.org/wsdl/soap/",
'trace' => 1));
$itemPriceDiscInventory = array(
"Item" => array(
"Klantnummer" => null,
"Artikelnr" => null,
"Aantal" => null,
"KortingsPercentage" => null,
"NettoPerEenheid" => null,
"Voorraad" => null
)
);
$params = array(
"itemPriceDiscInventory" => $itemPriceDiscInventory,
"customerNo" => '0000265',
"itemNo" => 'SAN483539',
"quantityVarDec" => '1.0'
);
echo $client->GetPriceDiscInvInformation($params);
stream_wrapper_restore('http');
这会导致错误。如果我收到最后的请求和响应,它会给我:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://xml.apache.org/xml-soap" 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:GetPriceDiscInvInformation>
<param0 xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">itemPriceDiscInventory</key>
<value xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">Item</key>
<value xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">Klantnummer</key>
<value xsi:nil="true"/>
</item>
<item>
<key xsi:type="xsd:string">Artikelnr</key>
<value xsi:nil="true"/>
</item>
<item>
<key xsi:type="xsd:string">Aantal</key>
<value xsi:nil="true"/>
</item>
<item>
<key xsi:type="xsd:string">KortingsPercentage</key>
<value xsi:nil="true"/>
</item>
<item>
<key xsi:type="xsd:string">NettoPerEenheid</key>
<value xsi:nil="true"/>
</item>
<item>
<key xsi:type="xsd:string">Voorraad</key>
<value xsi:nil="true"/>
</item>
</value>
</item>
</value>
</item>
<item>
<key xsi:type="xsd:string">customerNo</key>
<value xsi:type="xsd:string">0000265</value>
</item>
<item>
<key xsi:type="xsd:string">itemNo</key>
<value xsi:type="xsd:string">SAN483539</value>
</item>
<item>
<key xsi:type="xsd:string">quantityVarDec</key>
<value xsi:type="xsd:string">1.0</value>
</item>
</param0>
</ns1:GetPriceDiscInvInformation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
回复:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">a:Microsoft.Dynamics.Nav.Service.WebServices.ServiceBrokerException</faultcode>
<faultstring xml:lang="nl-NL">Parameter itemPriceDiscInventory in method GetPriceDiscInvInformation in service ItemPriceDiscInventory is null!</faultstring>
<detail>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Parameter itemPriceDiscInventory in method GetPriceDiscInvInformation in service ItemPriceDiscInventory is null!</string>
</detail>
</s:Fault>
</s:Body>
所以,看起来他正在尝试解析它,但是请求的格式不正确。注意:我不知道 uri 参数必须是什么。这是我可以从 WSDL 中读取的内容吗?
如果我看一下客户给我的请求和 SOAP 请求,它有很大的不同(第一个看起来根本不像 SOAP),但是对于 SOAP 请求,似乎是我再靠近一点。
对此有什么想法吗?
我终于明白了。首先我认为我的请求中的命名空间有问题。
我把WSDL文件保存在自己的服务器上,以WSDL方式用于soapclient,以navision服务器为位置。这奏效了!
我不知道为什么我不能在 WSDL 模式下使用直接 URL,但这是一个可以接受的解决方法。