2010-12-14 4 views
0

안녕하세요 먼저 불쌍한 영어에 대해 사과드립니다.톰캣이나 축없는 SOAP 통신

Eclipse로 개발합니다. 대상 플랫폼으로 나는 황새 치를 기본으로 사용합니다. SOAP로 프로토콜을 사용하고 Tomcat과 같은 Exta Kit는 사용하지 않습니다. 필자는 WSDL 파일을 작성했습니다. 황새치로 나는 공급자와 소비자를 만들었습니다. 처음에는 훌륭하게 작동합니다. 그러나 세션이 유효하지 않으므로 protocollinterface는 null입니다. Swordfish는 모든 연결을 자동으로 완전하게 만들고 캠이 내 인터페이스에 수동으로 연결하는 방법을 찾지 못했습니다. (Swordfish with OSGI) 어떻게 수동으로 연결을 다시 시도 할 수 있습니까? 여기

는 유용한

import java.util.Timer; 
import java.util.TimerTask; 

import org.apache.commons.logging.Log; 
import org.apache.commons.logging.LogFactory; 
import org.springframework.beans.factory.InitializingBean; 
import org.springframework.util.Assert; 
import org.iecimpl.serverserverprotocoll.ServerServerProtocoll; 

public class ServerServerProtocollClientInvoker implements InitializingBean { 
    private static final Log LOG = LogFactory.getLog(ServerServerProtocollClientInvoker.class); 
private Integer delayBeforeSending = 5000; 
private ServerServerProtocoll serverServerProtocoll; 
public ServerServerProtocoll getServerServerProtocoll() { 
    return serverServerProtocoll; 
} 

public void setServerServerProtocoll(ServerServerProtocoll serverServerProtocoll) { 
    this.serverServerProtocoll = serverServerProtocoll; 
} 

public Integer getDelayBeforeSending() { 
    return delayBeforeSending; 
} 

public void setDelayBeforeSending(Integer delayBeforeSending) { 
    this.delayBeforeSending = delayBeforeSending; 
} 

public void afterPropertiesSet() throws Exception { 
    Assert.notNull(serverServerProtocoll); 
    Timer timer = new Timer(); 
     timer.schedule(new TimerTask() { 
      @Override 
      public void run() { 
       try { 
        performRequest(); 
       } catch (Exception ex) { 
        throw new RuntimeException(ex); 
       } 
      } 


     }, delayBeforeSending); 
    } 
private void performRequest() { 
    LOG.info("Performing invocation on ..."); 
    /*Implementation*/ 
    clienttest.testclienttest(serverServerProtocoll); 
    LOG.info("Result of runing is...."); 
} 
} 

XML 파일이 될 몇 가지 코드 :

xml under META-INF/spring/jaxws-consumer.xml 
<?xml version="1.0" encoding="UTF-8"?> 

<!-- 
Copyright (c) 2008, 2009 SOPERA GmbH. 
All rights reserved. This program and the accompanying materials 
are made available under the terms of the Eclipse Public License v1.0 
which accompanies this distribution, and is available at 
http://www.eclipse.org/legal/epl-v10.html 

Contributors: 
    SOPERA GmbH - initial API and implementation 
--> 

<spring:beans xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:osgi="http://www.springframework.org/schema/osgi" 
    xmlns:camel-osgi="ht_tp://activemq.apache.org/camel/schema/osgi" 
    xmlns:http="http://servicemix.apache.org/http/1.0" 
    xmlns:jaxws="http://cxf.apache.org/jaxws" 
    xsi:schemaLocation=" 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
    http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd 
    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd 
    http://servicemix.apache.org/http/1.0 http://servicemix.apache.org/http/1.0/servicemix-http.xsd" 
    xmlns:serviceNamespace="ht_tp://www.IECImpl.org/ServerServerProtocoll/" 
    xmlns="ht-tp://www.IECImpl.org/ServerServerProtocoll/">  

<spring:import resource="classpath:META-INF/cxf/cxf.xml" /> 
<spring:import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> 
<spring:import resource="classpath:META-INF/org/eclipse/swordfish/plugins/cxf/support/nmr-transport.xml" /> 

<jaxws:client id="ServerServerProtocollClient" 
       serviceClass="org.iecimpl.serverserverprotocoll.ServerServerProtocoll" 
       serviceName="serviceNamespace:ServerServerProtocoll" 
       address="nmr:ServerServerProtocoll" /> 
<spring:bean class="org.iecimpl.serverserverprotocoll.sample.ServerServerProtocollClientInvoker"> 
<spring:property name="serverServerProtocoll" ref="ServerServerProtocollClient"/> 
</spring:bean>  


<spring:bean class="org.apache.servicemix.common.osgi.EndpointExporter" /> 

<http:endpoint endpoint="cxfEndpointHttpProvider"     
      service="serviceNamespace:ServerServerProtocoll" 
      locationURI="http://localhost:1001/EnergyServer" 
      soap="true" 
      role="provider"/> 

모든 데이터가 정의되어 있지만, 나는이 지역에서 newbee입니다.

+0

아니요 아이디어가 없습니까? 아무도? – Muuh

+0

eclipse IDE에서 수동으로 서비스에 연결 하시겠습니까? – UVM

+0

죄송합니다. 나는 당신에게 답변이 있다는 것을 보지 못했습니다. Springmetadata를 사용하지 않고 Javacode에서 동적으로 연결하려고합니다. – Muuh

답변

1

나는 왜 당신이 "느슨한"serverServerProtocoll의 가치를 궁금합니까 ??? 게시 한 코드에서 명확하지 않습니다. 황새치는 내부적으로 CXF를 사용 , 당신은 단순히 소비자의 봄 구성 내부 org.apache.cxf.jaxws.JaxWsProxyFactoryBean 을 만들 수 있습니다 값이 "갑자기"널 들어갔을 경우, 당신은이 해결 방법을 시도 할 수

... 것을 수행 과제가 있어야합니다.

서비스를 위해 클라이언트가 필요할 때마다 Spring 애플리케이션 컨텍스트에 정의 된 factory bean을 사용하여 클라이언트를 작성할 수있다.

참조 : Configuring a Spring Client (Option 2)