wsdl 文件描述:
......<xsd:element name="queryAllCustomersByConditionResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true" type="ns1:ArrayOfCustomer"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element><xsd:complexType name="ArrayOfCustomer">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="Customer" nillable="true" type="ns1:Customer"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Customer">
<xsd:sequence>
<xsd:element minOccurs="0" name="addrCode" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="address" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="certCode" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="createDate" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="cusCode" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="cusId" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="cusName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="cusPhone" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="cusState" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="cusType" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="mem" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="mobilePhone" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
........
<wsdl:operation name="queryCustomersByCondition">
<wsdl:input name="queryCustomersByConditionRequest" message="tns:queryCustomersByConditionRequest"/>
<wsdl:output name="queryCustomersByConditionResponse" message="tns:queryCustomersByConditionResponse"/>
<wsdl:fault name="CallException" message="tns:CallException"/>
</wsdl:operation>
.......axis 客户端怎么获取Customer数据?TCPMoniter的监控内容是:HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)/Tomcat-5.5
Content-Type: text/xml;charset=UTF-8
Date: Wed, 29 Jul 2009 08:44:53 GMT
Connection: close<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<queryCustomersByConditionResponse xmlns="http://service.call.sms.star.com">
<out><ns1:Customer xmlns:ns1="http://outter.model.sms.star.com">
<addrCode xmlns="http://outter.model.sms.star.com">00301014</addrCode>
<address xmlns="http://outter.model.sms.star.com">天津市河西....</address>
<certCode xmlns="http://outter.model.sms.star.com">120103197310076726</certCode>
<createDate xmlns="http://outter.model.sms.star.com">20061114</createDate>
<cusCode xmlns="http://outter.model.sms.star.com">103000023466</cusCode>
<cusId xmlns="http://outter.model.sms.star.com">21322</cusId>
<cusName xmlns="http://outter.model.sms.star.com">.....</cusName>
<cusPhone xmlns="http://outter.model.sms.star.com">88233366</cusPhone>
<cusState xmlns="http://outter.model.sms.star.com">EXISTING</cusState>
<cusType xmlns="http://outter.model.sms.star.com">INDIVIDUAL</cusType>
<mem xmlns="http://outter.model.sms.star.com" xsi:nil="true" />
<mobilePhone xmlns="http://outter.model.sms.star.com" xsi:nil="true" />
</ns1:Customer>
</out>
</queryCustomersByConditionResponse>
</soap:Body>
</soap:Envelope>我写的客户端测试类:package com.sitech.ismp.ws;import org.apache.axis.client.Call;
import org.apache.axis.message.SOAPHeaderElement;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import javax.xml.namespace.QName;
import java.rmi.RemoteException;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;public class TestClient {
public static void main(String[] strings) {
Service service = new Service();
Call call;
try {
Customer custom=new Customer();
call = (Call) service.createCall();
call.setTargetEndpointAddress("http://localhost:8081/ccintfms/InfoQueryService");
call.addHeader(new SOAPHeaderElement("NAMESPACE_STARSMS","CALLCENTER_USERNAME","StarCallCenter"));
call.addHeader(new SOAPHeaderElement("NAMESPACE_STARSMS","CALLCENTER_PASSWORD","StarCallCenter"));
call.addHeader(new SOAPHeaderElement("NAMESPACE_STARSMS","CALLCENTER_VERSION","1.5")); call.setOperationName("queryCustomersByCondition");
call.addParameter("in0", XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter("in1", XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter("in2", XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter("in3", XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter("in4", XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter("in5", XMLType.XSD_STRING,ParameterMode.IN);
//方法一:
//注册SimpleObject的序列化类型
QName q1=new QName("ns1:ArrayOfCustomer","ArrayOfCustomer");
call.registerTypeMapping(Customer[].class,q1,
new BeanSerializerFactory(Customer[].class,q1),
new BeanDeserializerFactory(Customer[].class,q1));
QName q2=new QName("ns1:ArrayOfCustomer","Customer");
call.registerTypeMapping(Customer.class,q2,
new BeanSerializerFactory(Customer.class,q2),
new BeanDeserializerFactory(Customer.class,q2));
call.setReturnClass(Customer.class);
//call.setReturnType(XMLType.XSD_STRING);
//方法二: 注意命名空间
// QName q1=new QName("ns1:ArrayOfCustomer","ArrayOfCustomer");
// call.registerTypeMapping(Customer[].class,q1,
// new BeanSerializerFactory(Customer[].class,q1),
// new BeanDeserializerFactory(Customer[].class,q1));
// QName q2=new QName("ns1:ArrayOfCustomer","Customer");
// call.registerTypeMapping(Customer.class,q2,
// new BeanSerializerFactory(Customer.class,q2),
// new BeanDeserializerFactory(Customer.class,q2));
// call.setReturnClass(Customer.class);
Object[] argSend={"103000023466","","","","",""};
Customer[] cus=(Customer[])call.invoke(argSend);
System.out.println("--------------succful--------------------"); } catch (ServiceException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (RemoteException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
}
运行错误:
总是提示 Customer 类无效因深夜连接测试环境,所以没有把具体报错信息贴出。
......<xsd:element name="queryAllCustomersByConditionResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true" type="ns1:ArrayOfCustomer"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element><xsd:complexType name="ArrayOfCustomer">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="Customer" nillable="true" type="ns1:Customer"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Customer">
<xsd:sequence>
<xsd:element minOccurs="0" name="addrCode" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="address" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="certCode" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="createDate" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="cusCode" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="cusId" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="cusName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="cusPhone" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="cusState" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="cusType" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="mem" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="mobilePhone" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
........
<wsdl:operation name="queryCustomersByCondition">
<wsdl:input name="queryCustomersByConditionRequest" message="tns:queryCustomersByConditionRequest"/>
<wsdl:output name="queryCustomersByConditionResponse" message="tns:queryCustomersByConditionResponse"/>
<wsdl:fault name="CallException" message="tns:CallException"/>
</wsdl:operation>
.......axis 客户端怎么获取Customer数据?TCPMoniter的监控内容是:HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)/Tomcat-5.5
Content-Type: text/xml;charset=UTF-8
Date: Wed, 29 Jul 2009 08:44:53 GMT
Connection: close<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<queryCustomersByConditionResponse xmlns="http://service.call.sms.star.com">
<out><ns1:Customer xmlns:ns1="http://outter.model.sms.star.com">
<addrCode xmlns="http://outter.model.sms.star.com">00301014</addrCode>
<address xmlns="http://outter.model.sms.star.com">天津市河西....</address>
<certCode xmlns="http://outter.model.sms.star.com">120103197310076726</certCode>
<createDate xmlns="http://outter.model.sms.star.com">20061114</createDate>
<cusCode xmlns="http://outter.model.sms.star.com">103000023466</cusCode>
<cusId xmlns="http://outter.model.sms.star.com">21322</cusId>
<cusName xmlns="http://outter.model.sms.star.com">.....</cusName>
<cusPhone xmlns="http://outter.model.sms.star.com">88233366</cusPhone>
<cusState xmlns="http://outter.model.sms.star.com">EXISTING</cusState>
<cusType xmlns="http://outter.model.sms.star.com">INDIVIDUAL</cusType>
<mem xmlns="http://outter.model.sms.star.com" xsi:nil="true" />
<mobilePhone xmlns="http://outter.model.sms.star.com" xsi:nil="true" />
</ns1:Customer>
</out>
</queryCustomersByConditionResponse>
</soap:Body>
</soap:Envelope>我写的客户端测试类:package com.sitech.ismp.ws;import org.apache.axis.client.Call;
import org.apache.axis.message.SOAPHeaderElement;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import javax.xml.namespace.QName;
import java.rmi.RemoteException;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;public class TestClient {
public static void main(String[] strings) {
Service service = new Service();
Call call;
try {
Customer custom=new Customer();
call = (Call) service.createCall();
call.setTargetEndpointAddress("http://localhost:8081/ccintfms/InfoQueryService");
call.addHeader(new SOAPHeaderElement("NAMESPACE_STARSMS","CALLCENTER_USERNAME","StarCallCenter"));
call.addHeader(new SOAPHeaderElement("NAMESPACE_STARSMS","CALLCENTER_PASSWORD","StarCallCenter"));
call.addHeader(new SOAPHeaderElement("NAMESPACE_STARSMS","CALLCENTER_VERSION","1.5")); call.setOperationName("queryCustomersByCondition");
call.addParameter("in0", XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter("in1", XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter("in2", XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter("in3", XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter("in4", XMLType.XSD_STRING,ParameterMode.IN);
call.addParameter("in5", XMLType.XSD_STRING,ParameterMode.IN);
//方法一:
//注册SimpleObject的序列化类型
QName q1=new QName("ns1:ArrayOfCustomer","ArrayOfCustomer");
call.registerTypeMapping(Customer[].class,q1,
new BeanSerializerFactory(Customer[].class,q1),
new BeanDeserializerFactory(Customer[].class,q1));
QName q2=new QName("ns1:ArrayOfCustomer","Customer");
call.registerTypeMapping(Customer.class,q2,
new BeanSerializerFactory(Customer.class,q2),
new BeanDeserializerFactory(Customer.class,q2));
call.setReturnClass(Customer.class);
//call.setReturnType(XMLType.XSD_STRING);
//方法二: 注意命名空间
// QName q1=new QName("ns1:ArrayOfCustomer","ArrayOfCustomer");
// call.registerTypeMapping(Customer[].class,q1,
// new BeanSerializerFactory(Customer[].class,q1),
// new BeanDeserializerFactory(Customer[].class,q1));
// QName q2=new QName("ns1:ArrayOfCustomer","Customer");
// call.registerTypeMapping(Customer.class,q2,
// new BeanSerializerFactory(Customer.class,q2),
// new BeanDeserializerFactory(Customer.class,q2));
// call.setReturnClass(Customer.class);
Object[] argSend={"103000023466","","","","",""};
Customer[] cus=(Customer[])call.invoke(argSend);
System.out.println("--------------succful--------------------"); } catch (ServiceException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (RemoteException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
}
运行错误:
总是提示 Customer 类无效因深夜连接测试环境,所以没有把具体报错信息贴出。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货