2013-06-19 2 views
1

내가 이런 SOAP 요청을 가지고, 그것을 잘 작동하고 :SOAP 요청 수정

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > 
    <soapenv:Header/> 
    <soapenv:Body> 
     <ConversionRate xmlns="http://com/">> 
    <!--Optional:--> 
    <FromCurrency>?</FromCurrency> 
    <!--Optional:--> 
    <ToCurrency>?</ToCurrency> 
    </ConversionRate> 
    </soapenv:Body> 
</soapenv:Envelope> 

두 번째가되지 않습니다 :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://com/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
    <web:ConversionRate> 
    <!--Optional:--> 
    <FromCurrency>?</FromCurrency> 
    <!--Optional:--> 
    <ToCurrency>?</ToCurrency> 
    </web:ConversionRate> 
</soapenv:Body> 
</soapenv:Envelope> 

내가 개념을 이해하기 위해 요청에게 저 작은 비트를 변경했다 일하고, 틀린 대답을 던집니다.

내 서비스 클래스는 두 번째 요청이 항상 경우, 건이며, 값이 나는 이름 공간을 변경 이후에 null를 보내는을 기본 떨어지는

package com; 
import javax.jws.WebService; 

import javax.jws.WebMethod; 
import javax.jws.WebParam; 


@WebService (targetNamespace="http://com/") 
public class CurrencyConvertor 
{ 
public String ConversionRate (@WebParam(name = "FromCurrency") String FromCurrency, @WebParam(name = "ToCurrency") String ToCurrency) 
{ 
System.out.println("ST\n" + FromCurrency + "\n" + ToCurrency + "\nEnd"); 
switch(FromCurrency+","+ToCurrency) 
{ 
case "USD,INR": 
return "58"; 

case "INR,USD": 
return "0.017"; 

default: 
return "XXX"; 

} 
} 
} 

입니다. 그래서 제 웹 서비스가 두 번째 요청에 적절하게 응답해야합니다. 문제의 원인은 무엇이며 어떻게 수정해야합니까?

답변

0

네임 스페이스가 올바르지 않더라도 올바르지 않습니다. com을 com.example로 변경해야합니다. com 전용 링크가있는 답변을 게시 할 수 없기 때문입니다.

tns = http://com.example/은 에 정의되어 있으며 webmethod가 아닙니다. 심지어 나는 XML은

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > 
    <soapenv:Header/> 
    <soapenv:Body> 
     <ConversionRate xmlns="http://com.example/"> 
    <FromCurrency>?</FromCurrency> 
    <ToCurrency>?</ToCurrency> 
    </ConversionRate> 
    </soapenv:Body> 
</soapenv:Envelope> 

또는 네임 스페이스를 단지 좋은 작업 매개 변수

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > 
    <soapenv:Header/> 
    <soapenv:Body> 
     <ConversionRate> 
    <FromCurrency xmlns="http://com.example/">?</FromCurrency> 
    <ToCurrency xmlns="http://com.example/">?</ToCurrency> 
    </ConversionRate> 
    </soapenv:Body> 
</soapenv:Envelope> 
+0

그것의 필요 올바른 형식이 있는지 확실히 확실하지 않다

public String ConversionRate ( @WebParam(name = "FromCurrency", tagetNamespace = "http://com.example/") String FromCurrency, @WebParam(name = "ToCurrency", tagetNamespace = "http://com.example/") String ToCurrency) { ... } 

에 메소드 선언을 변경 .. ! –