<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2004 Sun Microsystems, Inc. All rights reserved.
SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
-->
<configuration
xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
<wsdl
location="http://localhost:8080/WSHello/webservice?WSDL"
packageName="WSHello" />
</configuration> |
User.class
UserInfoIntf.class
UserInfoIntf_getUser_RequestStruct.class
UserInfoIntf_getUser_RequestStruct_SOAPBuilder.class
UserInfoIntf_getUser_RequestStruct_SOAPSerializer.class
UserInfoIntf_getUser_ResponseStruct.class
UserInfoIntf_getUser_ResponseStruct_SOAPBuilder.class
UserInfoIntf_getUser_ResponseStruct_SOAPSerializer.class
UserInfoIntf_Stub.class
User_SOAPBuilder.class
User_SOAPSerializer.class
Webservice.class
Webservice_Impl.class
Webservice_SerializerRegistry.class |
package WSHello;
import java.rmi.RemoteException;
import javax.xml.rpc.Stub;
public class WSHelloClient {
public WSHelloClient() {
}
public static void main(String[] args) {
try {
Webservice_Impl webservice = new Webservice_Impl();
Stub stub = (Stub) webservice.getUserInfoIntfPort();
UserInfoIntf userInfo = (UserInfoIntf)stub;
User user = userInfo.getUser("후루꾸",19);
System.out.println("사용자 : "+user.getName());
System.out.println("나이 : "+user.getAge());
}
catch (RemoteException e) {
e.printStackTrace();
}
}
} |
package WSHello;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.Stub;
public class WSDynamicHello {
public WSDynamicHello() {
}
public static void main(String[] args) {
/**
* 작성한 WSDL 문서를 참고하여 아래의 항목을 웹서비스에 맞게 수정한다.
*/
String WSUrl = "http://localhost:8080/WSHello/webservice?WSDL";
String Qname = "http://localhost:8888/hello/webservice/wsdl/webservice";
String serviceName = "Webservice";
String PortName = "UserInfoIntfPort";
try {
ServiceFactory servicefactory = ServiceFactory.newInstance();
URL wsdlUrl = new URL(WSUrl);
QName serviceQname = new QName(Qname,serviceName);
Service service = servicefactory.createService(wsdlUrl, serviceQname);
QName portQname = new QName (Qname,PortName);
Stub stub = (Stub) service.getPort(portQname, UserInfoIntf.class);
UserInfoIntf userInfo = (UserInfoIntf)stub;
User user = userInfo.getUser("후루꾸",19);
System.out.println("사용자 : "+user.getName());
System.out.println("나이 : "+user.getAge());
}
catch (ServiceException e) {
e.printStackTrace();
}
catch (MalformedURLException e) {
e.printStackTrace();
}
catch (RemoteException e) {
e.printStackTrace();
}
}
} |
package WSHello;
import java.rmi.RemoteException;
import javax.xml.rpc.*;
import javax.xml.namespace.*;
import java.net.*;
public class WSCallHello {
public WSCallHello() {
}
public static void main(String[] args) {
/**
* 작성한 WSDL 문서를 참고하여 아래의 항목을 웹서비스에 맞게 수정한다.
*/
String WSUrl = "http://localhost:8080/WSHello/webservice?WSDL";
String Qname = "http://localhost:8888/hello/webservice/wsdl/webservice";
String serviceName = "Webservice";
String PortName = "UserInfoIntfPort";
String EndPoint = "http://localhost:8080/WSHello/webservice";
try {
ServiceFactory servicefactory = ServiceFactory.newInstance();
QName serviceQname = new QName(Qname,serviceName);
Service service = servicefactory.createService(serviceQname);
QName portQname = new QName (Qname,PortName);
Call call = service.createCall(portQname);
call.setTargetEndpointAddress(EndPoint);
call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
call.setProperty("javax.xml.rpc.encodingstyle.namespace.uri",
"http://schemas.xmlsoap.org/soap/encoding/");
call.setOperationName(
new QName(Qname,"getUser"));
call.addParameter("String_1",
new QName("http://www.w3.org/2001/XMLSchema","string"),
ParameterMode.IN);
call.addParameter("int_2",
new QName("http://www.w3.org/2001/XMLSchema","int"),
ParameterMode.IN);
call.setReturnType(
new QName("http://localhost:8888/hello/webservice/type/webservice","User"));
Object[] params = {new String("후루꾸"), new Integer(19)};
User user = (User)call.invoke(params);
System.out.println("사용자 : "+user.getName());
System.out.println("나이 : "+user.getAge());
}
catch (ServiceException e) {
e.printStackTrace();
}
catch (RemoteException e) {
e.printStackTrace();
}
}
} |