2012-07-20 3 views
0

저는 Spring-WS를 처음 사용하기 때문에 프로젝트 용 WebService를 만들어야했습니다. 몇 가지 예제를 시도하기 위해 spring-webservices-samples 파일을 다운로드했습니다. http://code.google.com/p/spring-webservices-samples/Spring-WS : 응답 메시지에 이상한 문자가 포함되었습니다.

SoapUI를 사용하여 war 파일을 배포하고 테스트 할 때, 응답 메시지에서 이상한 문자 (예 : ce, 1a, 0)가 발생하고 "CalculateResponse"요소가 비어 있습니다.

<ns2:CalculateResponse xmlns:ns2='http://www.marvelution.com/samples/schemas/CalculatorServiceSchema'/> 

그리고 예외는 없습니다. 디버깅을 시도했지만 운이 없었습니다.

제발 도와주세요. 나는 정말로 어떤 의견이라도 고맙다.

저는 JBoss 4.2.3, Java 1.6 (64 비트)을 사용하고 있습니다.

Tomcat-7.0.29에 같은 war 파일을 배포하려고 시도했지만 작동합니다. 하지만 내 WebService에 4.2.3

요청이 tcpmon을 사용하여 캡처 보스에서 작업을 진행해야한다 :

POST /annotated-payload-endpoint/calculatorService HTTP/1.1 
    Accept-Encoding: gzip,deflate 
    Content-Type: text/xml;charset=UTF-8 
    SOAPAction: "http://www.marvelution.com/samples/definitions/CalculatorService/Add" 
    Content-Length: 377 
    Host: 127.0.0.1:9999 
    Connection: Keep-Alive 
    User-Agent: Apache-HttpClient/4.1.1 (java 1.5) 

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cal="http://www.marvelution.com/samples/schemas/CalculatorServiceSchema"> 
     <soapenv:Header/> 
     <soapenv:Body> 
      <cal:Add> 
      <!--2 or more repetitions:--> 
      <cal:number>1</cal:number> 
      <cal:number>2</cal:number> 
      </cal:Add> 
     </soapenv:Body> 
    </soapenv:Envelope> 

응답 tcpmon을을 사용하여 캡처 :

HTTP/1.1 200 OK 
    Server: Apache-Coyote/1.1 
    X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0 
    SOAPAction: "" 
    Content-Type: text/xml;charset=UTF-8 
    Transfer-Encoding: chunked 
    Date: Fri, 20 Jul 2012 01:47:23 GMT 

    ce 
    <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><ns2:CalculateResponse xmlns:ns2='http://www.marvelution.com/samples/schemas/CalculatorServiceSchema'/> 
    1a 
    </env:Body></env:Envelope> 
    0 

엔드 포인트 : CalculatorEndpoint합니다. java

@PayloadRoot(namespace = "http://www.marvelution.com/samples/schemas/CalculatorServiceSchema", localPart = "Add") 
    public CalculateResponse add(Add numbers) { 
     CalculateResponse res = wrapResult(calculator.add(numbers.getNumber())); 
     System.out.println("Response before sending:"+res.getResult()); 
     return res; 
    } 

응답을 반환하기 바로 전에 System.out.println이 인쇄됩니다. 이 캐릭터가 추가되는 위치와 응답이 불완전한 이유는 확실하지 않습니다.

덕분에, JEG

답변

0

나는 문제가 무엇인지 알게되었습니다. JBoss에서 제공하는 SAAJ 구현에는 몇 가지 문제가 있습니다. (즉,이 기본 JBoss 구현 "org.jboss.ws.core.soap.MessageFactoryImpl"에 문제가 있음) 솔루션은 JBoss 구현을 사용하지 않고 다른 구현을 사용합니다. 이미 com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessage Factory1_1Impl org.apache.axis2.saaj.MessageFactoryImpl

<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"> 
    <property name="messageFactory"> 
     <bean class="org.apache.axis2.saaj.MessageFactoryImpl"/> 
    </property> 
</bean> 

이 문제는 다음 구현 중 하나를 사용 : 예

여기에보고 : URL : http://static.springsource.org/sprin...tml#saaj-jboss

관련 문제