views:

456

answers:

1

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.

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"&gt;
  <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>

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/"&gt;
  <soap:Header/>
  <soap:Body>
    <doPlaceHoldRequest 
                xmlns="http://www.mycompany.com/MyService/schemas"&gt;
      <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>

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?

+1  A: 

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