2012-02-13 3 views
1

정보를 얻기 위해 웹 서비스에 연결하는 클라이언트가 있습니다. 다른 포트를 사용하는 여러 서비스에 동일한 정보를 보내야하는 요구 사항이 있습니다. 클라이언트 코드를 수정하지 않고이 문제를 해결하기 위해 필자는 MULE ESB를 발견했다.MULE ESB : 하나의 클라이언트에 여러 웹 서비스 바인딩하기

MULE ESB와 하나의 포트를 사용하여 하나의 클라이언트를 하나의 서비스에 연결할 수있는 가이드를 찾았지만 서비스를 체인화하는 방법을 찾을 수 없으므로 모두 하나의 포트를 수신하지만 자체적으로 다릅니다.

이처럼 보이도록 해야하는 방법입니다 Conceptual Diagram

UPDATE :

여기

내 현재 뮬 응용 프로그램 구성된다

:

다음
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="CE-3.2.1" xsi:schemaLocation=" 
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd "> 
    <flow name="flows1Flow1" doc:name="flows1Flow1"> 
     <http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:4433/miniwebservice" mimeType="text/xml" doc:name="HTTP"/> 
     <http:outbound-endpoint exchange-pattern="request-response" address="http://localhost:4434/miniwebservice?wsdl" mimeType="text/xml" doc:name="HTTP"/> 
    </flow> 
</mule> 

가 WebService에있다

고객 :

package miniwebservice; 

import java.net.URL; 
import javax.xml.namespace.QName; 
import javax.xml.ws.Service; 

public class TestWsClient 
{ 
    public static void main(final String[] args) throws Throwable 
    { 
     String url = (args.length > 0) ? args[0] : "http://localhost:4434/miniwebservice"; 
     Service service = Service.create(
      new URL(url + "?wsdl"), 
      new QName("http://miniwebservice/", "HalloWeltImplService")); 
     HalloWelt halloWelt = service.getPort(HalloWelt.class); 
     System.out.println("\n" + halloWelt.hallo(args.length > 1 ? args[1] : "")); 
    } 
} 

서버 :

package miniwebservice; 

import javax.xml.ws.Endpoint; 

public class TestWsServer 
{ 
    public static void main(final String[] args) 
    { 
     String url = (args.length > 0) ? args[0] : "http://localhost:4434/miniwebservice"; 
     Endpoint.publish(url, new HalloWeltImpl()); 
    } 
} 

InterfaceImpl :

package miniwebservice; 

import javax.jws.WebService; 

@WebService(endpointInterface="miniwebservice.HalloWelt") 
public class HalloWeltImpl implements HalloWelt 
{ 
    public String hallo(String wer) 
    { 
     return "Hallo " + wer; 
    } 
} 

인터페이스 :

package miniwebservice; 

import javax.jws.*; 

@WebService 
public interface HalloWelt 
{ 
    public String hallo(@WebParam(name = "wer") String wer); 
} 

나는 서버와 뮬 aplication를 시작하고 http://localhost:4434/miniwebservice?wsdl 심고 http://localhost:4433/miniwebservice I에 도달하려고하면 folowing 예외를 안으로 얻으십시오 내 브라우저 (FireFox 8.0) :

XML 리더 오류 : javax.xml.stream.XMLStreamException : ParseError at [row, col] : [1,1] 메시지 : 내용 프롤로그에서는 허용되지 않습니다.

방금 ​​노새와 일하기 시작 했으므로 서비스에 노새를 리다이렉트하여 wsdl을 얻는 것이 좋겠지 만 그게 조금 복잡해 보입니다.

+0

이러한 웹 서비스의 성격은 어떻습니까? SOAP 스타일?또한 : Mule은 3 개의 호출에서 결과를 집계하거나 하나를 선택하거나 다른 원격 서비스를 대체로 사용해야합니까? (1 호 통화, 1 호기가 다운되면 2 호로 대체 ...)? –

+0

@David Dossot 질문을 편집하여 새로운 정보를 추가했습니다. – Kiesa

+0

대상 서비스 URL에서? wsdl을 제거하십시오. 그렇지 않으면 모든 요청을 WSDL 생성기로 파이프합니다. –

답변

1

포기 :

  • 이 여러 서비스, 집계 결과에 발송하는 단계를 포함 모든 문제에 대한 최종 솔루션하지만 오른쪽 방향으로 단계는 아니다.
  • 이것은 웹 서비스 프록시가 Mule (way simpler)에서 수행되는 방식을 나타내지는 않지만 HTTP 요청 라우팅에 대한 베어 본 방식을 사용하므로 집계를 추가 할 수 있습니다. ? 당신은 HTTP GET 웹 서비스에 대한 WSDL 프로세서 및 HTTP POST SOAP 요청에 요청을 전달하려는 때문에

, 당신은 자신을 대상 HTTP 메소드를 처리해야하고 URI 전파를 요청 :

<flow name="flows1Flow1"> 
    <http:inbound-endpoint exchange-pattern="request-response" 
     address="http://localhost:4433/miniwebservice" /> 
    <message-properties-transformer scope="outbound"> 
     <add-message-property key="http.method" value="#[header:INBOUND:http.method]" /> 
    </message-properties-transformer> 
    <logger level="INFO" category="ddo" /> 
    <http:outbound-endpoint exchange-pattern="request-response" 
     address="http://localhost:4434#[header:INBOUND:http.request]" /> 
</flow> 

(TestWsClient 및 TestWsServer를 사용하여 테스트 및 검증 됨)

관련 문제