본문 바로가기

Snippets

AXIS2 WSDL2JAVA

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

AXIS2경로\bin\wsdl2java.bat -uri [WSDL의 경로] -o [Generating될 Java Source 경로]-u


이를 통하여 만들어진 경우 CXF와는 좀 다르게 Stub 까지만 떨어짐.


그래서 실제 통신할 수 있는 class를 추가적으로 만들어야함. 아래 소스를 참고...


예)


public static DT_SR getResult(DT_S s)

{

DT_SR sr = null;

try

{

OutServiceStub stub = new OutServiceStub();

// HTTP Basic Auth가 존재하는 경우

Options options = stub._getServiceClient().getOptions();

HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();

auth.setPreemptiveAuthentication(true);

auth.setUsername(username);

auth.setPassword(password);

options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE , auth);

MSG_S p = new MSG_S();

p.setMSG_S(s);

MSG_SR result = stub.sRC_Out(p);

sr = result.getMSG_SR();

}

catch(Exception e)

{

e.printStackTrace();

}

return sr;

}