2013-05-27 2 views
2

저는 wsimport로 생성 된 소스를 가진 비누 클라이언트를 가지고 있습니다.
나는 내 pom.xml 파일JAX-WS wsimport는 로컬 wsdl과 xsd 파일을 사용합니다.

 <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>jaxws-maven-plugin</artifactId> 
      <version>1.10</version> 
      <executions> 
       <execution> 
        <goals> 
         <goal>wsimport</goal> 
        </goals> 
        <configuration> 
         <wsdlFiles> 
          <wsdlFile>example.com_8080/services/test.wsdl</wsdlFile> 
         </wsdlFiles> 
         <wsdlLocation>http://example.com:8080/services/test?wsdl</wsdlLocation> 
         <staleFile>${project.build.directory}/jaxws/stale/test.stale</staleFile> 
        </configuration> 
        <id>wsimport-generate-test</id> 
        <phase>generate-sources</phase> 
       </execution> 
      </executions> 
      <dependencies> 
       <dependency> 
        <groupId>javax.xml</groupId> 
        <artifactId>webservices-api</artifactId> 
        <version>1.4</version> 
       </dependency> 
      </dependencies> 
      <configuration> 
       <sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir> 
       <xnocompile>true</xnocompile> 
       <verbose>true</verbose> 
       <extension>true</extension> 
       <catalog>${basedir}/src/jax-ws-catalog.xml</catalog> 
      </configuration> 
     </plugin> 

에서 다음 설정을 사용하고 난 원격 서버에서 WSDL/XSD (http://example.com:8080/services/test?wsdl)마다에 요청을하지 않는 가장 좋은 방법 하우투를 찾고 있어요. 그래서 로컬 wsdl/xsd 파일을 사용하고 싶습니다. 그것은 가능합니까? genra

+0

브라우저에서 xsd URL을보고 로컬 사본을 저장하십시오. – kolossus

답변

0

비슷한 문제가있었습니다. wsimport는 your_ws_nameService.java라는 .java 파일을 생성해야합니다.

static { 
    URL url = null; 
    try { 
     URL baseUrl; 
     baseUrl = com.oracle.xmlns.orawsv.ORAWSVService.class.getResource("."); 
     url = new URL(baseUrl, "http://127.0.0.1:7101/test/test?WSDL"); 
    } catch (MalformedURLException e) { 
     logger.warning("Failed to create URL for the wsdl Location: 'http://127.0.0.1:7101/test/test?WSDL', retrying as a local file"); 
     logger.warning(e.getMessage()); 
    } 
    ORAWSVSERVICE_WSDL_LOCATION = url; 
} 

변경 이런 일이 섹션 :

static { 
    URL url = null; 
    try { 
     URL baseUrl; 
     baseUrl = mypackage.my_ws_client.my_ws_clientService.class.getResource("my_ws.wsdl"); 
     url = new URL(baseUrl,""); 
    } catch (MalformedURLException e) { 
     logger.warning("Failed to create URL for the local wsdl file."); 
     logger.warning(e.getMessage()); 
    } 
    SENDINFOSERVICE_WSDL_LOCATION = url; 
} 

이 클라이언트 내부에있는 WSDL 파일을 읽을이 파일은 다음처럼 보이는 부분이 있어야합니다. 당연히 당신은 먼저 거기에 그것을 가지고 있어야하는데, 그것은 kolossus가 제안한 것처럼 브라우저에서 다운로드 할 수 있습니다.