정보를 얻기 위해 웹 서비스에 연결하는 클라이언트가 있습니다. 다른 포트를 사용하는 여러 서비스에 동일한 정보를 보내야하는 요구 사항이 있습니다. 클라이언트 코드를 수정하지 않고이 문제를 해결하기 위해 필자는 MULE ESB를 발견했다.MULE ESB : 하나의 클라이언트에 여러 웹 서비스 바인딩하기
MULE ESB와 하나의 포트를 사용하여 하나의 클라이언트를 하나의 서비스에 연결할 수있는 가이드를 찾았지만 서비스를 체인화하는 방법을 찾을 수 없으므로 모두 하나의 포트를 수신하지만 자체적으로 다릅니다.
이처럼 보이도록 해야하는 방법입니다
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을 얻는 것이 좋겠지 만 그게 조금 복잡해 보입니다.
이러한 웹 서비스의 성격은 어떻습니까? SOAP 스타일?또한 : Mule은 3 개의 호출에서 결과를 집계하거나 하나를 선택하거나 다른 원격 서비스를 대체로 사용해야합니까? (1 호 통화, 1 호기가 다운되면 2 호로 대체 ...)? –
@David Dossot 질문을 편집하여 새로운 정보를 추가했습니다. – Kiesa
대상 서비스 URL에서? wsdl을 제거하십시오. 그렇지 않으면 모든 요청을 WSDL 생성기로 파이프합니다. –