111,096
社区成员




void fun1()
{
sms_sp.Web_SmsSP.SMSSendTask smsst = new sms_sp.Web_SmsSP.SMSSendTask();
sms_sp.Web_SmsSP.ExtMediaTaskBean[] emtb_arr = new sms_sp.Web_SmsSP.ExtMediaTaskBean[3];
emtb_arr[0] = new sms_sp.Web_SmsSP.ExtMediaTaskBean();
//emtb_arr[0].sendTime = ....;
//....
emtb_arr[1] = new sms_sp.Web_SmsSP.ExtMediaTaskBean();
//emtb_arr[1].sendTime = ....;
//....;
emtb_arr[2] = new sms_sp.Web_SmsSP.ExtMediaTaskBean();
//emtb_arr[2].sendTime = ....;
//....;
smsst.sendMediaTask(emtb_arr);
}
package com.webservice;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.xml.namespace.QName;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties;
import com.huawei.sports.utilities.MD5Tool;
import com.huawei.sports.webservice.ExtMediaTaskBean;
import com.huawei.sports.webservice.MediaBean;
import com.huawei.sports.webservice.MediaResultBean;
public class ClientTest
{
/**
* @param args
* @throws Exception
*/
public static void main11(String[] args) throws Exception
{
System.out.println(new SimpleDateFormat("MMdd").format(new Date()));
}
public static void main(String[] args) throws Exception
{
String url = "http://61.156.3.152:9090/services/SMSSendTask";
//String url = "http://localhost:9090/services/SMSSendTask";
String namespace = "http://webservice.sports.huawei.com";
String operateName = "sendMediaTask";
//String operateName = "getMediasBean";
ProxyProperties proxyProperties = new ProxyProperties();
proxyProperties.setProxyName("10.237.0.203");
proxyProperties.setProxyPort(808);
RPCServiceClient client = new RPCServiceClient();
client.addHeader(createHeaderOMElement());
/******************----***********/
//OMFactory fac = OMAbstractFactory.getOMFactory();
//QName qname = new QName(namespace, "upload");
//OMElement data = fac.createOMElement(qname);
/*****************-----***********/
//client.sendReceive(data);
Options option = client.getOptions();
EndpointReference erf = new EndpointReference(url);
option.setTo(erf);
option.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
option.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
option.setTransportInProtocol(Constants.TRANSPORT_HTTP);
option.setProperty(HTTPConstants.PROXY, proxyProperties);
option.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION,
HTTPConstants.HEADER_PROTOCOL_10);
client.setOptions(option);
QName name = new QName(namespace, "sendMediaTask");
//QName name = new QName(namespace, "getMediasBean");
ExtMediaTaskBean ob1 = new ExtMediaTaskBean();
ob1.setSpId("SP1141000155183");
ob1.setSubject("SPTEST");
ob1.setSendNo("10655116114");
ob1.setReceiverInfo("13256675150");
ob1.setContent("123SDA");
ob1.setAccessoryPath("20120723183001-SP1141000155343.zip");
ob1.setSendTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2012-05-25 13:00:00"));
//ob1.setSendTime(new Date("2011-12-24"));
ExtMediaTaskBean ob2 = new ExtMediaTaskBean();
ExtMediaTaskBean[] ob = new ExtMediaTaskBean[] { ob1 };
//Object [] object = new Object[]{"SP1141000155243","2011-11-01 00:00:00","2012-05-01 00:00:00"};
Object[] object = new Object[] { ob };
//Class [] returnTypes = new Class[] { MediaBean[].class };
Class[] returnTypes = new Class[] { MediaResultBean[].class };
Object[] response = client.invokeBlocking(name, object, returnTypes);
MediaBean[] p = (MediaBean[]) response[0];
for (int i = 0; i < p.length; i++)
{
System.out.println(p[i].getContent() + "--" + p[i].getSendno());
}
}
public static OMElement createHeaderOMElement()
{
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace SecurityElementNamespace = factory.createOMNamespace("http://handler.com",
"wsse");
OMElement authenticationOM = factory.createOMElement("Authentication",
SecurityElementNamespace);
OMElement sequence = factory.createOMElement("sequence",
SecurityElementNamespace);
OMElement spid = factory.createOMElement("spid",
SecurityElementNamespace);
OMElement timestamp = factory.createOMElement("timestamp",
SecurityElementNamespace);
OMElement key = factory.createOMElement("key", SecurityElementNamespace);
sequence.setText("001");
spid.setText("SP1141000155183");
timestamp.setText("20111222010101");
key.setText(MD5Tool.generateMD5String("001" + "SP1141000155183"
+ "116114" + "20111222010101"));
authenticationOM.addChild(sequence);
authenticationOM.addChild(spid);
authenticationOM.addChild(timestamp);
authenticationOM.addChild(key);
return authenticationOM;
}
}
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://webservice.sports.huawei.com" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ax21="http://webservice.sports.huawei.com/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://webservice.sports.huawei.com">
<wsdl:documentation>SMSSendTask</wsdl:documentation>
- <wsdl:types>
- <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://webservice.sports.huawei.com/xsd">
- <xs:complexType name="MediaBean">
- <xs:sequence>
<xs:element minOccurs="0" name="accepttime" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="content" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="id" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="receiverinfo" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="sendno" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
- <xs:complexType name="ExtMediaTaskBean">
- <xs:sequence>
<xs:element minOccurs="0" name="accessoryPath" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="content" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="priority" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="receiverInfo" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="sendNo" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="sendTime" nillable="true" type="xs:dateTime" />
<xs:element minOccurs="0" name="serviceId" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="spId" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="staffNo" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="subject" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
- <xs:complexType name="MediaResultBean">
- <xs:sequence>
<xs:element minOccurs="0" name="index" type="xs:int" />
<xs:element minOccurs="0" name="mediaTaskID" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="resultNo" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
- <xs:schema xmlns:ax22="http://webservice.sports.huawei.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://webservice.sports.huawei.com">
<xs:import namespace="http://webservice.sports.huawei.com/xsd" />
- <xs:element name="getMediasBean">
- <xs:complexType>
- <xs:sequence>
<xs:element minOccurs="0" name="spid" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="beginDate" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="endDate" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getMediasBeanResponse">
- <xs:complexType>
- <xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax22:MediaBean" />
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="sendMediaTask">
- <xs:complexType>
- <xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="extMediaTasks" nillable="true" type="ax22:ExtMediaTaskBean" />
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="sendMediaTaskResponse">
- <xs:complexType>
- <xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax22:MediaResultBean" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
- <wsdl:message name="getMediasBeanRequest">
<wsdl:part name="parameters" element="ns:getMediasBean" />
</wsdl:message>
- <wsdl:message name="getMediasBeanResponse">
<wsdl:part name="parameters" element="ns:getMediasBeanResponse" />
</wsdl:message>
- <wsdl:message name="sendMediaTaskRequest">
<wsdl:part name="parameters" element="ns:sendMediaTask" />
</wsdl:message>
- <wsdl:message name="sendMediaTaskResponse">
<wsdl:part name="parameters" element="ns:sendMediaTaskResponse" />
</wsdl:message>
- <wsdl:portType name="SMSSendTaskPortType">
- <wsdl:operation name="getMediasBean">
<wsdl:input message="ns:getMediasBeanRequest" wsaw:Action="urn:getMediasBean" />
<wsdl:output message="ns:getMediasBeanResponse" wsaw:Action="urn:getMediasBeanResponse" />
</wsdl:operation>
- <wsdl:operation name="sendMediaTask">
<wsdl:input message="ns:sendMediaTaskRequest" wsaw:Action="urn:sendMediaTask" />
<wsdl:output message="ns:sendMediaTaskResponse" wsaw:Action="urn:sendMediaTaskResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="SMSSendTaskSoap11Binding" type="ns:SMSSendTaskPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <wsdl:operation name="getMediasBean">
<soap:operation soapAction="urn:getMediasBean" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="sendMediaTask">
<soap:operation soapAction="urn:sendMediaTask" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:binding name="SMSSendTaskSoap12Binding" type="ns:SMSSendTaskPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <wsdl:operation name="getMediasBean">
<soap12:operation soapAction="urn:getMediasBean" style="document" />
- <wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="sendMediaTask">
<soap12:operation soapAction="urn:sendMediaTask" style="document" />
- <wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:binding name="SMSSendTaskHttpBinding" type="ns:SMSSendTaskPortType">
<http:binding verb="POST" />
- <wsdl:operation name="getMediasBean">
<http:operation location="SMSSendTask/getMediasBean" />
- <wsdl:input>
<mime:content type="text/xml" part="getMediasBean" />
</wsdl:input>
- <wsdl:output>
<mime:content type="text/xml" part="getMediasBean" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="sendMediaTask">
<http:operation location="SMSSendTask/sendMediaTask" />
- <wsdl:input>
<mime:content type="text/xml" part="sendMediaTask" />
</wsdl:input>
- <wsdl:output>
<mime:content type="text/xml" part="sendMediaTask" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="SMSSendTask">
- <wsdl:port name="SMSSendTaskHttpSoap11Endpoint" binding="ns:SMSSendTaskSoap11Binding">
<soap:address location="http://134.32.32.152:9090/services/SMSSendTask.SMSSendTaskHttpSoap11Endpoint/" />
</wsdl:port>
- <wsdl:port name="SMSSendTaskHttpSoap12Endpoint" binding="ns:SMSSendTaskSoap12Binding">
<soap12:address location="http://134.32.32.152:9090/services/SMSSendTask.SMSSendTaskHttpSoap12Endpoint/" />
</wsdl:port>
- <wsdl:port name="SMSSendTaskHttpEndpoint" binding="ns:SMSSendTaskHttpBinding">
<http:address location="http://134.32.32.152:9090/services/SMSSendTask.SMSSendTaskHttpEndpoint/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>