2012-11-17 4 views
1

나는 간단한 Axis2 클라이언트를 가지고있다. 나는 가벼운 콘테이너로 Spring를 사용했다. 제 질문은 axis2 클라이언트와 spring 사이에 통합이 있습니까? 나는 봄에 org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean 클래스를 익숙하게했지만 docy는 axis2과 함께 작동하는지 알지 못합니다.Axis2 클라이언트 쪽 Spring

답변

0

link 당신이 먼저 축 2 엔드 포인트에서 스텁 코드를 생성 할 필요가에서

을해야 할 일의 일반적인 아이디어를 제공 할 수 있습니다. 받는다는과 축 2의 받는다는 플러그를 사용하여 다음과 같이이다 :

<plugin> 
       <groupId>org.apache.axis2</groupId> 
       <artifactId>axis2-wsdl2code-maven-plugin</artifactId> 

       <version>${axis.version}</version> 
       <executions> 
        <execution> 
         <phase>generate-sources</phase> 
         <goals> 
          <goal>wsdl2code</goal> 
         </goals> 
         <configuration> 
          <wsdlFile>{axis2wsdl-url} or src/main/resources/wsdl/{downloaded wsdl file}</wsdlFile> 
          <packageName>com.cybersource.stub</packageName> 
          <databindingName>xmlbeans</databindingName> 

         </configuration> 
        </execution> 
       </executions>    
      </plugin> 

다음은 당신이 받는다는 저장소에 생성 된 jar 파일을 설치해야합니다. 스텁 코드가 생성되고 "ant"를 실행하면 필요한 jar 파일이 생성되고 repo에 설치해야합니다.

@Bean 
    public ConfigurationContext getConfigurationContext() throws AxisFault { 
     ConfigurationContext ctx = ConfigurationContextFactory 
       .createConfigurationContextFromFileSystem(config.getAxisConfigLocation(), null); 
     return ctx; 
    } 

    @Bean 
    public Policy getOMElement() throws FileNotFoundException { 
     String policyLocation = config.getAxisConfigLocation() + "/conf/policy.xml"; 
     InputStream in = new FileInputStream(policyLocation); 
     OMXMLParserWrapper omxmlParserWrapper = OMXMLBuilderFactory.createOMBuilder(in); 
     Policy policy = PolicyEngine.getPolicy(omxmlParserWrapper.getDocumentElement()); 
     return policy; 
    } 

당신이 어딘가에이 같은 축 설정 파일 복사에 config.getAxisConfigLocation()를 설정해야합니다 :

enter image description here

의를

당신은 봄 부팅이 두 콩을 추가 사용하는 경우 위의 스키마 axis2.xml은 axis2 컨텍스트를 생성하는 데 중요합니다. policy.xml 및 rampart-xxx.mar 파일은 서버가 서버를 처리하는 방법을 알아야하는 인증 용입니다.

@Autowired 
    ConfigurationContext ctx; 

    @Autowired 
    Policy policy; 

private TransactionProcessorStub generateStub() throws AxisFault { 
     TransactionProcessorStub stub = new TransactionProcessorStub(ctx, config.getServerurl()); 
     ServiceClient client = stub._getServiceClient(); 
     Options clientOptions = client.getOptions(); 
     clientOptions.setProperty(WSHandlerConstants.USER, config.getMerchantid()); 

     clientOptions.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy); 
     client.setOptions(clientOptions); 
     client.engageModule("rampart"); 

     return stub; 
    } 
+0

이 링크는 질문에 대답 할 수 있지만, 여기에 해답의 본질적인 부분을 포함하는 것이 좋습니다 : 당신의 커넥터 섹션에서

당신은 CTX 및/또는 정책 콩을 주입하고이 같은 스텁을 생성해야 참조 용 링크를 제공하십시오. 링크 된 페이지가 변경되면 링크 전용 답변이 유효하지 않게 될 수 있습니다. - [리뷰에서] (리뷰/저품절 포스트/18048002) –