在操作标记内定义名称空间时,如何处理Castor解封SOAP消息? [英] How can I handle Castor unmarshaling of SOAP messages when the namespace is defined inside the operation tag?

查看:140
本文介绍了在操作标记内定义名称空间时,如何处理Castor解封SOAP消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发基于Spring-WS的合同优先的Web服务。我依靠Castor封送处理,因此遇到了以下问题。

I am developing a contract-first web service based on Spring-WS. I'm relying on Castor marshaling, and I have run into the following issue.

在信封标记中定义了 xmlns命名空间时,请求被接受,例如:

Requests are being accepted when the "xmlns" namespace is defined in the Envelope tag, such as:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
                      xmlns="http://www.mycompany.com/MyService/schemas">
  <soap:Header/>
  <soap:Body>
    <doPlaceHoldRequest>
      <hold>
        <accountInfo>
          <accountNumber>123456789</accountNumber>
        </accountInfo>
        <extended>false</extended>
        <afterHours>false</afterHours>
        <amountSavings>1.00</amountSavings>
        <amountChecking>0.00</amountChecking>
      </hold>
    </doPlaceHoldRequest>
  </soap:Body>
</soap:Envelope>

但是,.NET和Java客户端都是通过Spring-WS提供的.wsdl生成的(从XSD生成),以以下方式形成他们的请求:

However, both .NET and Java clients generated from the .wsdl provided by Spring-WS (which was generated from a XSD), form their requests in the following manner:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header/>
  <soap:Body>
    <doPlaceHoldRequest 
                xmlns="http://www.mycompany.com/MyService/schemas">
      <hold>
        <accountInfo>
          <accountNumber>123456789</accountNumber>
        </accountInfo>
        <extended>false</extended>
        <afterHours>false</afterHours>
        <amountSavings>1.00</amountSavings>
        <amountChecking>0.00</amountChecking>
      </hold>
    </doPlaceHoldRequest>
  </soap:Body>
</soap:Envelope>

这会导致Castor抛出解组异常。如何让Castor识别这些消息为有效消息?

Which results in an Unmarshalling Exception being thrown by Castor. How do I get Castor to recognize these messages as valid? Could my WSDL (or the XSD I used to autogenerate it) be wrong?

推荐答案

如果我看到了我认为永远不会出现的Blog,我的WSDL(或我用来自动生成它的XSD)会出错吗?转到其他网络服务:)
http:// springkbase.blogspot.com/2009/06/spring-webservice-with-castor.html

IF u see this blog i think will never go to other webservices :) http://springkbase.blogspot.com/2009/06/spring-webservice-with-castor.html

这篇关于在操作标记内定义名称空间时,如何处理Castor解封SOAP消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆