Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
由于xml错误导致soap php调用出现问题_Php_Xml_Soap_Webserver - Fatal编程技术网

由于xml错误导致soap php调用出现问题

由于xml错误导致soap php调用出现问题,php,xml,soap,webserver,Php,Xml,Soap,Webserver,我正在尝试对web服务进行soap调用,以传递装运数据。以下是我目前发送的请求: <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://weblabeling.gls-italy.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:enc="http://www.w3.org/2003/05/soap-encodin

我正在尝试对web服务进行soap调用,以传递装运数据。以下是我目前发送的请求:

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://weblabeling.gls-italy.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
    <env:Body>
        <ns1:AddParcel env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
        <!-- bof shipping array --->
            <XMLInfoParcel>
                <Info>
                    <SedeGls>XXXX</SedeGls>
                    <CodiceClienteGls>XXXXX</CodiceClienteGls>
                    <PasswordClienteGls>XXXXXX</PasswordClienteGls>
                    <Parcel>
                        <CodiceContrattoGls>XXXXXX</CodiceContrattoGls>
                        <RagioneSociale>XXXXXX</RagioneSociale>
                        <!-- other stuff here -->
                    </Parcel>
                </Info>
            </XMLInfoParcel>
            <!-- eof shipping array --->
        </ns1:AddParcel>
    </env:Body>
</env:Envelope>    
@Iserni我把-->只放在这里,这不在我的代码中,我要测试在线工具,我真的没有看到错误

我仍然得到xml格式的错误,还有其他线索吗

编辑:

我刚刚注意到我的要求:

<ns1:AddParcel env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">

而所需的是:

<AddParcel xmlns="http://weblabeling.gls-italy.com/">

所以我注意到信封中还有一些名称空间的不同之处。 这可能是问题所在吗

WSDL似乎在gls服务器上不起作用,他们并没有在文档中提供任何关于它的信息

编辑:

也许我很笨,但这是请求xml模式:

那么现在我应该在前面添加更多的空格吗?
你怎么认为?如果是这样,怎么办?

您的XML中有三个错误,但是您可以使用
xmllint
轻松地找到它们(以及将来的错误)

基本上,XML注释应该以
-->
结尾,而不是
-->
,并且应该检查标记的打开/关闭


另外,请求是针对
string
,但这不是您要发送的…?

我认为您应该添加相关代码如何创建Soap请求XML.php是Soap的噩梦。。。。我建议您将nusoap库调整到您的项目中,并查看它如何使xml执行itAh不,php Soap非常好。另外,如果你看问题,你会发现Fabio已经非常接近了。@Fabio:除了
元素之外,其他一切看起来都不错。如果你添加代码,那么你如何创建请求,尤其是添加该代码对你的问题很有用。是的,我想我已经非常接近了。实际上,我用一个类生成xml,数据存储在db中。我会在脚本中添加一部分,我认为这些评论已经添加到问题中,以显示OP关注的部分。但也许你是对的,我也有这种怀疑;“string”也是一样,我预期会出现与“XML格式错误”不同的错误。除非GLS代码将任何错误都作为“XML格式错误”拒绝,否则我发现了如何设置参数值的典型问题。它应该是一个字符串,但请求中的类型很复杂。如果在创建一种
SoapVar
@Iserni:string时放入一个数组,就会发生这种情况。事实上,我没有包括所有的请求结构。我只是在我的问题中添加了数组,您可以从中看到它需要什么。为什么不使用标准方法创建正确的请求?为什么要使用
$gls->buildXMLRequest()
?您不使用WSDL并让
SoapClient
为您做这项工作有什么具体原因吗?
<ns1:AddParcel env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<AddParcel xmlns="http://weblabeling.gls-italy.com/">