Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.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
Java CXF webservice客户端,如何处理来自被调用webservice的响应?_Java_Soap_Cxf_Webservice Client - Fatal编程技术网

Java CXF webservice客户端,如何处理来自被调用webservice的响应?

Java CXF webservice客户端,如何处理来自被调用webservice的响应?,java,soap,cxf,webservice-client,Java,Soap,Cxf,Webservice Client,我已经实现了一个webservice客户机,该客户机在webapplication(使用Spring)中使用,该客户机得到一个响应,在该响应中,CXF发出了一条错误消息 错误消息是: 服务器未识别HTTP头SOAPAction的值 我发现了问题,但不知道如何调整我的webservice响应处理 下面的xml响应可以正常工作 工作正常,可以接受 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/

我已经实现了一个webservice客户机,该客户机在webapplication(使用Spring)中使用,该客户机得到一个响应,在该响应中,CXF发出了一条错误消息

错误消息是:

服务器未识别HTTP头SOAPAction的值

我发现了问题,但不知道如何调整我的webservice响应处理

下面的xml响应可以正常工作

工作正常,可以接受

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bar="http://www.dummyurl.com/service-v1.0/">
    <soapenv:Header/>
    <soapenv:Body>
        <bar:StartSessionResponse>
            <result>1</result>
        </bar:StartSessionResponse>
    </soapenv:Body>
</soapenv:Envelope>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <StartSessionResponse xmlns="www.dummyurl.com/service-v1.0/">
            <result xmlns="">1</result>
        </StartSessionResponse>
    </soap:Body>
</soap:Envelope>

1.
该服务实际返回:

失败并给我一个错误

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bar="http://www.dummyurl.com/service-v1.0/">
    <soapenv:Header/>
    <soapenv:Body>
        <bar:StartSessionResponse>
            <result>1</result>
        </bar:StartSessionResponse>
    </soapenv:Body>
</soapenv:Envelope>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <StartSessionResponse xmlns="www.dummyurl.com/service-v1.0/">
            <result xmlns="">1</result>
        </StartSessionResponse>
    </soap:Body>
</soap:Envelope>

1.
据我所知,不同之处在于

xmlns=“www.dummyurl.com/service-v1.0/元素,在成功的xml中,它位于Envelope中,在失败的xml中,它位于Response方法上


是否有办法说服CXF接受响应?或者服务返回异常结果?

在第二种情况下,假设第一个响应正确,服务返回错误响应

在第一种情况下,“www.dummyurl.com/service-v1.0/”是元素的名称空间-StartSessionResponse,结果不符合名称空间。在第二种情况下,StartSessionResponse与第一个示例具有相同的名称空间,但结果具有完全不同的名称空间,去掉xmlns=”“因为结果将使xml保持一致