2013-05-16 1 views
0

안녕하세요, 적용하고 싶습니다. 매우 간단하지만 어떻게 설명해야하는지 잘 모르겠습니다. 여기에 시나리오가 있습니다 : 웹 서비스 메서드를 호출하고 싶습니다.이 메서드 이름은 find()이며 개체의 인수로 받아 들여지고 개체는 구성된 기본 키를 나타내며 id와 type의 두 문자열로 구성됩니다. 비누의 기본 키 - 표현 - 어떤 목적은 다음과 같습니다Mule esb에서 여러 args를 사용하는 웹 서비스 메소드를 사용하십시오.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsd="http://wsdouane/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <wsd:find> 
     <entity> 
      <id>string_1</id> 
      <type>string_2</type> 
     </entity> 
     </wsd:find> 
    </soapenv:Body> 
</soapenv:Envelope> 

내 첫 번째 아이디어는 원하는 기본 키 객체를 생성하기 위해 HTTP POST 요청에서 두 개의 인수를 (ID와 유형) 읽기에 대해이었다 기본 키 클래스 생성자를 호출하는 자바 트랜스 포머로 생성 된 객체를 비누 컴포넌트에 전달하여 객체에 기반한 비누 요청을 생성 한 다음 http 컴포넌트로 웹 서비스를 호출하고 마지막으로 응답을 파일에 작성한다. 이 결과 흐름 :

<flow name="testObjetFlow1" doc:name="testObjetFlow1"> 
    <http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8088" doc:name="HTTP"/> 
    <custom-transformer class="com.test.transformer.HttpRequestToPrimaryKeyObject" doc:name="PK Object Transformer"/> 
    <cxf:jaxws-client operation="find" serviceClass="douane.Douane" port="douanePort" doc:name="SOAP"/> 
    <http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8080/ClientsDB/douane" doc:name="douaneWS"/> 
    <mulexml:object-to-xml-transformer doc:name="Object to XML"/> 
    <file:outbound-endpoint path="C:\MuleStudio\SandBox\output" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].xml " responseTimeout="10000" doc:name="Outgoing File"/> 
</flow> 

내 사용자 정의 변압기

package com.test.transformer; 

import org.mule.api.MuleMessage; 
import org.mule.api.transformer.TransformerException; 
import org.mule.transformer.AbstractMessageTransformer; 
import douane.DouanePK; 
public class HttpRequestToPrimaryKeyObject extends AbstractMessageTransformer { 

    @Override 
    //DouanePK represent the primary key entity 
    public DouanePK transformMessage(MuleMessage message, String outputEncoding) 
      throws TransformerException { 
     // TODO Auto-generated method stub 
     String id = message.getInboundProperty("id"); 
     String type = message.getInboundProperty("type"); 

     DouanePK primKey = new DouanePK(); 
     dp.setId(id); 
     dp.setType(type); 

     return primKey; 
    } 

} 

내가 프로젝트를 실행할 때 오류를 얻을 내 논리가 잘못된 경우 또는 경우 내가 잘 모릅니다

ERROR 2013-05-16 09:44:13,191 [[mediation_mod].testObjetFlow1.stage1.03] org.mule.exception.DefaultMessagingExceptionStrategy: 
******************************************************************************** 
Message    : Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() : Cannot marshal the XStream instance in action 
---- Debugging information ---- 
------------------------------- 
message    : Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() 
cause-exception  : com.thoughtworks.xstream.converters.ConversionException 
cause-message  : Cannot marshal the XStream instance in action 
------------------------------- (com.thoughtworks.xstream.converters.ConversionException). Message payload is of type: byte[] 
Code     : MULE_ERROR--2 
-------------------------------------------------------------------------------- 
Exception stack is: 
1. Cannot marshal the XStream instance in action 
---- Debugging information ---- 
------------------------------- (com.thoughtworks.xstream.converters.ConversionException) 
    com.thoughtworks.xstream.converters.reflection.SelfStreamingInstanceChecker:44 (null) 
2. Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() : Cannot marshal the XStream instance in action 
---- Debugging information ---- 
------------------------------- 
message    : Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() 
cause-exception  : com.thoughtworks.xstream.converters.ConversionException 
cause-message  : Cannot marshal the XStream instance in action 
------------------------------- (com.thoughtworks.xstream.converters.ConversionException) 
    com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker:140 (null) 
3. Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() : Cannot marshal the XStream instance in action 
---- Debugging information ---- 
------------------------------- 
message    : Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() 
cause-exception  : com.thoughtworks.xstream.converters.ConversionException 
cause-message  : Cannot marshal the XStream instance in action 
------------------------------- (com.thoughtworks.xstream.converters.ConversionException). Message payload is of type: byte[] (org.mule.api.transformer.TransformerMessagingException) 
    org.mule.transformer.AbstractTransformer:139 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerMessagingException.html) 
-------------------------------------------------------------------------------- 
Root Exception stack trace: 
com.thoughtworks.xstream.converters.ConversionException: Cannot marshal the XStream instance in action 
---- Debugging information ---- 
------------------------------- 
    at com.thoughtworks.xstream.converters.reflection.SelfStreamingInstanceChecker.marshal(SelfStreamingInstanceChecker.java:44) 
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69) 
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58) 
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) 
******************************************************************************** 

ERROR 2013-05-16 09:44:13,182 [[mediation_mod].testObjetFlow1.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
******************************************************************************** 
Message    : Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() : Cannot marshal the XStream instance in action 
---- Debugging information ---- 
------------------------------- 
message    : Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() 
cause-exception  : com.thoughtworks.xstream.converters.ConversionException 
cause-message  : Cannot marshal the XStream instance in action 
------------------------------- (com.thoughtworks.xstream.converters.ConversionException). Message payload is of type: byte[] 
Code     : MULE_ERROR--2 
-------------------------------------------------------------------------------- 
Exception stack is: 
1. Cannot marshal the XStream instance in action 
---- Debugging information ---- 
------------------------------- (com.thoughtworks.xstream.converters.ConversionException) 
    com.thoughtworks.xstream.converters.reflection.SelfStreamingInstanceChecker:44 (null) 
2. Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() : Cannot marshal the XStream instance in action 
---- Debugging information ---- 
------------------------------- 
message    : Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() 
cause-exception  : com.thoughtworks.xstream.converters.ConversionException 
cause-message  : Cannot marshal the XStream instance in action 
------------------------------- (com.thoughtworks.xstream.converters.ConversionException) 
    com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker:140 (null) 
3. Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() : Cannot marshal the XStream instance in action 
---- Debugging information ---- 
------------------------------- 
message    : Could not call org.apache.cxf.binding.soap.SoapMessage.writeObject() 
cause-exception  : com.thoughtworks.xstream.converters.ConversionException 
cause-message  : Cannot marshal the XStream instance in action 
------------------------------- (com.thoughtworks.xstream.converters.ConversionException). Message payload is of type: byte[] (org.mule.api.transformer.TransformerMessagingException) 
    org.mule.transformer.AbstractTransformer:139 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerMessagingException.html) 
-------------------------------------------------------------------------------- 
Root Exception stack trace: 
com.thoughtworks.xstream.converters.ConversionException: Cannot marshal the XStream instance in action 
---- Debugging information ---- 
------------------------------- 
    at com.thoughtworks.xstream.converters.reflection.SelfStreamingInstanceChecker.marshal(SelfStreamingInstanceChecker.java:44) 
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69) 
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58) 
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) 
******************************************************************************** 

가 작업을 완료하는 간단한 방법입니까? 당신을 도와주세요. 당신이 받고있는 예외가 SoapMessage 변환하는 mulexml:object-to-xml-transformer의 무능력에서 오는,

<expression-transformer 
    expression="#[new douane.DouanePK(message.inboundProperties.id,message.inboundProperties.type)]" /> 

둘째 :

답변

1

첫째, 난 그냥 표현을 사용, 단순히 클래스의 인스턴스에 대한 custom-transformer을 만들 것 XStream을 사용하여 XML로 객체 (예상되는 종류). 흐름의 응답 단계에서이 언 마샬링을 수행하는 것은 cxf:jaxws-client의 책임입니다.

그래서 당신은 mulexml:object-to-xml-transformer에 필요 CXF 오른쪽 개체에 대한 응답을 비 정렬 후 cxf:jaxws-client 위의 response 요소의 file:outbound-endpoint 요소는 그래서 그들은 처리됩니다.

0

xml은 SOAP 구성 요소 때문에 발생합니다. 귀하의 경우에는 피할 수 있습니다. 그냥 사용 및 표현 tranformer