-------------------------------------------------- -------------- / ** * Copyright: Shutouxiang [E.ALPHA] All; * * EMAIL: Ealpha (AT) MSN (Dot) COM; * MSN: Ealpha (AT) MSN (Dot) Com; * QQ: 9690501 * * All reproduced please indicate this information! * / ------------------------------------------------ ---------------- Description: The system adopts AXIS, if there is no AXIS knowledge, it is recommended to search for the IBM developer to search related Axis document browsing ----------- ----------------------------
1. Configure AXIS 2, put the WSDL file copy to / tomcat_home / webApps / axis / web-infers
The WSDL file cannot generate Header by MISC; the new WSDL file after modification is:
element name = "TransactionID" type = "xsd: string" />
3 Generate the client, server code: Using the command: java -djava.ext.dirs = lib org.apache.axis.wsdl.wsdl2java --server-side --skeletondeploy true dsmp.wsdl 4, deploy.wsdd is used Publishing ServiceMaportBindingImpl.java service Short programming Using MaportBindingstub.java client programming Using 5, create service: Java org.apache.axis.utils.admin Client | Server Deploy.wsdd establishes service and client services.
6, write client test code:
Package com.smsmail.misc;
Import java.math.biginteger;
Import java.net.URL;
Import javax.xml.rpc.holders.stringHolder;
Import com.monternet.www.dsmp.schemas.address_info_schema;
Import com.monternet.www.dsmp.schemas.syncorderReLanceReqType;
Import com.monternet.www.dsmp.schemas.syncorderReranceRESPTYPE;
Import com.monternet.www.dsmp.schemas.user_id_schema;
Import com.monternet.www.dsmp.schemas.holders.syncorderReranceResptyPEHOLDER;
Import com.monternet.www.dsmp.wsdl.maportbindingstub;
/ *
* Mobile MISC system upgrade, SP client test environment
* /
Public class clienttet {
Private static Biginteger MSG;
Public static void main (String [] args) {
Maportbindingstub binding = null;
SyncOrderReranceResptype value = null;
SyncorderReranceReqType Req = new syncorderReLanceReqType ();
SyncorderReranceResptyholder syncorderReranceoutput = new syncorderReranceResptyPEHOLDER ();
StringHolder TransactionIdout = new stringholder ();
/ **
*
* TransactionID is determined by the corresponding field in the returned provision package, then put it in the corresponding field inside the response package.
* TransactionID is not SP generated
*
* /
/ / According to - Data Service Management Platform Interface Specification -
1.5.1
definition. Can refer to class files under Schemas
Biginteger DeviceTypese_address = Biginteger.Valueof (201);
Biginteger DeviceTypedSt_Address = Biginteger.Valueof (0);
Biginteger useridtypeeuser_id = Biginteger.Valueof (1);
Biginteger actionId = Biginteger.Valueof (1);
Biginteger ActionReasonId = Biginteger.Valueof (1);
Biginteger AccessMode = Biginteger.Valueof (3);
/ / Decide for some fixed values
Address_info_schema send_address = new address_info_schema ();
Send_address.SetDeviceID ("dev");
Send_address.SetDeviceType (DeviceTypesend_Address);
Address_INFO_SCHEMA DEST_ADDRESS = New Address_info_schema ();
DEST_ADDRESS.SETDEVICEID ("0011");
DEST_ADDRESS.SETDEVICETYPE (DeviceTypedSt_Address);
User_id_schema feeuser_id = new user_id_schema ();
Feeuser_id.seTmsISDN ("13817931870");
Feeuser_id.setUserIdType (useridtypefeeuser_id);
User_id_schema destuser_id = new user_id_schema ();
Destuser_id.setmsisdn ("13817931870");
Destuser_id.setUserIdType (useridtypefeeuser_id);
/ **
* Assign a value to the request
* /
Req.SETMSGTYPE ("SubscribeServiceReq");
Req.setversion
1.5.0
");
Req.setsend_address (sene_address);
Req.setDest_address (dest_address);
Req.setfeeuser_id (Feeuser_ID);
Req.SetDestuser_id (Destuser_ID);
Req.setLinkId ("); // Optional
Req.setActionID (ActionID);
Req.setActionReasonId (ActionReasonID);
Req.setspid ("800001");
Req.setspserviceID (" 021");
Req.setAccessmode (Accessmode);
Try {
URL ENDPOINT = New URL ("http: // localhost: 808 / axis / services / maport"); // See details 1 and Description 2 Description 3
Binding = (maportbindingstub) new com.monternet.www.dsmp.wsdl.dsmplocator (). getMaport (endpoint);
Binding.SetTimeout (60000);
Binding.syncorderRelation (Req, "27", SyncorderReranceoutput, TransactionIdout;
}
Catch (Exception E) {
E.PrintStackTrace ();
}
}
}
Description 1, the URL is the address submitted to the MISC platform in a real environment;
Description 2, the URL points to the local service address, must ensure that the URL is prompted to:
Maport hi there, this is an axis service!
Perhaps There Will Be A Form for Invoking The Service Here ... Description 3, the port of this URL is 808 because the listening port is forwarded to 808 in TCPMonitor. If you do not open TCPMonitor, set it to 8080
7, write service short return code
// Add return
SyncorderReranceResptype Ret = new syncorderReLanceResptype ();
Biginteger hret = Biginteger.Valueof (0);
RET.SETMSGTYPE ("SubscribeServiceResp");
Ret.sethret (hret);
Ret.setVersion ("
1.5.0
");
// Return NULL;
8, problem resolution:
n Due to each request SOAP packet namespace problem. Use the source file to modify the Axis 1.2 version: Source file
(This file is provided by netizens, passive code)
n contains xmls = "" problem
Modify the serializationContextImpl.java file, modify as follows
Public string qname2string (QName Qname, Boolean Writens) {string prefix = null; string namespaceuri = qname.getnamespaceuri ();
IF (Namespaceuri.Length () == 0) {if (writens) {// if this is unqualified (IE prefix "), set the default // namespace to" "string defaultns = nsstack.getnamespaceuri ("); IF (defaultns! = null && defaultns.length ()> 0) {// registerprefixForuri ("," ");}}} else {prefix = getPrefixForuri (namespaceuri);}
IF ((prefix == null) || (prefix.length () == 0) Return Qname.getlocalPart ();
StringBuffer SB = New StringBuffer; Sb.Append (':'); sb.append (qname.getlocalpart ()); return sb.toString ();