2014-12-08 4 views
3

Я создаю пружинный интеграции шлюза исходящей со следующей конфигурацией:Jaxb2Marshaller с Spring Integration

  • Прямые каналы invocationChannel и responseChannel
  • Один запрос трансформатора со следующей конфигурацией (обновлено обновление II)
  • конфигурация шлюза службы
  • Web:

@Configuration 
public class WebServiceConfiguration { 

@Bean 
@ServiceActivator(inputChannel = "invocationChannel") 
public MessageHandler wsOutboundGateway() throws Exception { 

    MarshallingWebServiceOutboundGateway gw = 
      new MarshallingWebServiceOutboundGateway(
        "http://localhost:8098/mockPort", 
        jaxb2Marshaller()); 
    gw.setOutputChannelName("responseChannel"); 
    return gw; 
} 

public Jaxb2Marshaller jaxb2Marshaller() throws Exception { 

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); 
    marshaller.setProcessExternalEntities(true); 
    // List of packages with XML Root elements (types) generated with Wsdl2Java 
    marshaller.setContextPaths(
      "com.company.wsdl.types.p1", "com.company.wsdl.types.p2"); 

} 

Но я получаю: «Невозможно создать конверт из данного источника, потому что пространство имена не было признаны», и я Хэ любой идеи об этой ошибке:

Caused by: com.sun.xml.internal.messaging.saaj.soap.SOAPVersionMismatchException: Unable to create envelope from given source because the namespace was not recognized 
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.lookForEnvelope(SOAPPartImpl.java:150) 
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:121) 
at com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:110) 
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:68) 
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:128) 
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:189) 

UPDATE

Я изменил мой ТипЗапрос для конверта, и, похоже, он распознается, но теперь я получаю: «org.springframework.ws.client.WebServiceTransportException: Internal Server Error [500]».

Мой сервер прослушивает через интерфейс SOAP и доступен в браузере.

ОБНОВЛЕНИЕ II

Трансформатор и Handler конфигурации:


SENDER 

@Transformer(inputChannel="requestChannel", outputChannel="invocationChannel") 
public ResquestType buildRequest(Message<String> msg) { 
//creates a ResquestType from msg param 
return ResquestType; 
} 

RESPONSE HANDLER 

@ServiceActivator(inputChannel="responseChannel") 
public int getResponse(Message<Envelope> msg) { 
// Builds the response status 
} 

Я посылаю структуру:

  • RequestType
  • Конверт
  • Заголовок
  • тела

Получение структуры:

  • Конверт
  • Заголовок
  • тела
  • ResponseType
+0

Показать, пожалуйста, искушение на стороне сервера. И поделитесь своей сущностью, которую вы отправляете через этот 'wsOutboundGateway' с' marshaller' –

+0

На стороне сервера нет исключения. Я смотрю журнал SOAP UI. Я отредактировал свой вопрос, чтобы уточнить структуру SOAP. Сервер ответит на ожидаемый ответ. – crm86

+0

Если у вас 'Internal Server Error [500]' должно быть что-то вроде StackTrace, чтобы определить проблему ... В противном случае мы не сможем вам помочь –

ответ

0

"org.springframework.ws.client.WebServiceTransportException: Internal Server Error [500]: Unable to create envelope from given source because the namespace was not recognized

SOAP UI имеет функцию отслеживания запроса/ответа. Используя это, вы можете посмотреть, где вы или ваш сервис обеспечиваете плохой XML для SOAP.

Смежные вопросы