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

时间:2022-10-25 14:05:36

i have implemented a webservice client that is used inside a webapplication (using Spring) and this client gets a response in which CXF bailsout and gives me an error message.

我已经实现了一个在Web应用程序中使用的Web服务客户端(使用Spring),并且该客户端获得一个响应,其中CXF挽救并给我一个错误消息。

The error message is:

错误消息是:

Server did not recognize the value of HTTP Header SOAPAction

服务器无法识别HTTP标头SOAPAction的值

I have found the problem but do not know what i can do to adjust my webservice response handling.

我发现了问题,但不知道我可以做些什么来调整我的webservice响应处理。

The xml response below works without any problems.

下面的xml响应没有任何问题。

Works and is accepted ok!

工作,并被接受确定!

<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>

The service actually returns:

该服务实际返回:

Fails and gives me an error!

失败并给我一个错误!

<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>

The difference as far as i can see is in the placing of the

据我所知,差异在于放置

xmlns="www.dummyurl.com/service-v1.0/ element, in the success xml it is in the enveloppe, in the failed xml it is on the reponse method.

xmlns =“www.dummyurl.com/service-v1.0/ element,在成功xml中它位于enveloppe中,在失败的xml中它位于响应方法上。

Is there a way that i can convince CXF to accept the response? Or is the service giving back an abnormal result?

有没有办法可以说服CXF接受回应?或者服务是否给出了异常结果?

1 个解决方案

#1


0  

The service is giving back a wrong response in the second case, assuming that the first response is proper.

假设第一个响应是正确的,该服务在第二种情况下回放错误的响应。

In the first case "www.dummyurl.com/service-v1.0/" is the namespace of your elements - StartSessionResponse, result is not qualified with the namespace. In the second case, the StartSessionResponse has the same namespace as the first sample, but the result has a different namespace altogether, taking out xmlns="" for result will make the xml consistent.

在第一种情况下,“www.dummyurl.com/service-v1.0/”是元素的命名空间 - StartSessionResponse,结果不符合命名空间。在第二种情况下,StartSessionResponse与第一个样本具有相同的名称空间,但结果总共有一个不同的名称空间,取结果的xmlns =“”将使xml保持一致。

#1


0  

The service is giving back a wrong response in the second case, assuming that the first response is proper.

假设第一个响应是正确的,该服务在第二种情况下回放错误的响应。

In the first case "www.dummyurl.com/service-v1.0/" is the namespace of your elements - StartSessionResponse, result is not qualified with the namespace. In the second case, the StartSessionResponse has the same namespace as the first sample, but the result has a different namespace altogether, taking out xmlns="" for result will make the xml consistent.

在第一种情况下,“www.dummyurl.com/service-v1.0/”是元素的命名空间 - StartSessionResponse,结果不符合命名空间。在第二种情况下,StartSessionResponse与第一个样本具有相同的名称空间,但结果总共有一个不同的名称空间,取结果的xmlns =“”将使xml保持一致。