用WSIF框架调用服务,出现了对象序列化的问题.该怎么解决?

解决方案 »

  1.   

    public class WisfTest {
    public static void main(String arg[]) {
    try {
    String url = "http://www.webxml.com.cn/webservices/DomesticAirline.asmx?wsdl";
    WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
    // AuthenticatingProxyWSDLLocatorImpl awsli=new
    // AuthenticatingProxyWSDLLocatorImpl(url,"gaolong1","19831001");
    WSIFService service = factory.getService(url,
    "http://WebXml.com.cn/",
    "DomesticAirline",
    "http://WebXml.com.cn/", "DomesticAirlineSoap");
    // 其参数分别代表:WSDL地址参数,Service命名空间参数,WSDL文档中Service名称参数,WSDL文档中的portType命名空间参数,WSDL文档中的portType名称参数
    WSIFPort port = service.getPort();
    WSIFOperation operation = port.createOperation("getDomesticAirlinesTime",
    "getDomesticAirlinesTimeSoapIn", "getDomesticAirlinesTimeSoapOut");
    // 根据给定的操作名称参数operationName,输入元素名称inputName,输出元素名称outputName.
    WSIFMessage input = operation.createInputMessage();
    // String startCity = "长沙";
    // String lastCity = "上海";
    // String date = "";
    // String userId = "";
    GetDomesticAirlinesTime inputParam = new GetDomesticAirlinesTime("长沙","上海","","");
    input.setObjectPart("parameters", inputParam);
    // input.setObjectPart("lastCity", lastCity);
    // input.setObjectPart("theDate", date);
    // input.setObjectPart("userID", userId);

    // 设置soap消息中part的表现内容
    WSIFMessage output = operation.createOutputMessage();
    WSIFMessage fault = operation.createFaultMessage();
    operation.executeRequestResponseOperation(input, output, fault);
    String Info = (String) output.getObjectPart("Return"); // 执行请求和接受响应消息的方法,第一个组作为输入的input消息被发送到服务器端,第二个代表输入响应的信息会在执行后包含着返回的消息,第三个消息用来封装错误和状态消息。
    System.out.println(Info);// 获得这个soap消息的表现内容
    } catch (WSIFException we) {
    we.printStackTrace();
    }
    }
    }
      

  2.   

    public class WisfTest {
    public static void main(String arg[]) {
    try {
    String url = "http://www.webxml.com.cn/webservices/DomesticAirline.asmx?wsdl";
    WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
    // AuthenticatingProxyWSDLLocatorImpl awsli=new
    // AuthenticatingProxyWSDLLocatorImpl(url,"gaolong1","19831001");
    WSIFService service = factory.getService(url,
    "http://WebXml.com.cn/",
    "DomesticAirline",
    "http://WebXml.com.cn/", "DomesticAirlineSoap");
    // 其参数分别代表:WSDL地址参数,Service命名空间参数,WSDL文档中Service名称参数,WSDL文档中的portType命名空间参数,WSDL文档中的portType名称参数
    WSIFPort port = service.getPort();
    WSIFOperation operation = port.createOperation("getDomesticAirlinesTime",
    "getDomesticAirlinesTimeSoapIn", "getDomesticAirlinesTimeSoapOut");
    // 根据给定的操作名称参数operationName,输入元素名称inputName,输出元素名称outputName.
    WSIFMessage input = operation.createInputMessage();
    // String startCity = "长沙";
    // String lastCity = "上海";
    // String date = "";
    // String userId = "";
    GetDomesticAirlinesTime inputParam = new GetDomesticAirlinesTime("长沙","上海","","");
    input.setObjectPart("parameters", inputParam);
    // input.setObjectPart("lastCity", lastCity);
    // input.setObjectPart("theDate", date);
    // input.setObjectPart("userID", userId);

    // 设置soap消息中part的表现内容
    WSIFMessage output = operation.createOutputMessage();
    WSIFMessage fault = operation.createFaultMessage();
    operation.executeRequestResponseOperation(input, output, fault);
    String Info = (String) output.getObjectPart("Return"); // 执行请求和接受响应消息的方法,第一个组作为输入的input消息被发送到服务器端,第二个代表输入响应的信息会在执行后包含着返回的消息,第三个消息用来封装错误和状态消息。
    System.out.println(Info);// 获得这个soap消息的表现内容
    } catch (WSIFException we) {
    we.printStackTrace();
    }
    }
    }
      

  3.   

    我是通过一个JAVABEAN将WSDL中的TYPE的数据封装起来.就是程序中的GetDomesticAirlinesTime,它该实现序列化接口的什么函数吗