响应我们发送的请求,远程服务器对我们的服务进行WS调用。这是一个这样的调用的Tomcat日志。
xxx.xx.xxx.x - - [12/May/2016:14:00:46 +0630] "POST /axis2/services/SmsNotificationService HTTP/1.1" 500 482
从http://xxx.xx.xxx.x:8088/axis2/services/SmsNotificationService?wsdl
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.csapi.org/wsdl/parlayx/sms/notification/v3_1/service" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:interface="http://www.csapi.org/wsdl/parlayx/sms/notification/v3_1/interface" name="parlayx_sms_notification_service" targetNamespace="http://www.csapi.org/wsdl/parlayx/sms/notification/v3_1/service">
<import namespace="http://www.csapi.org/wsdl/parlayx/sms/notification/v3_1/interface" location="SmsNotificationService?wsdl=parlayx_sms_notification_interface_3_1.wsdl">
</import>
<binding name="SmsNotificationBinding" type="interface:SmsNotification">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="notifySmsReception">
<soap:operation soapAction="" style="document"/>
<input>
<soap:header message="interface:NotifySOAPHeader" part="NotifySOAPHeader" use="literal">
</soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="notifySmsDeliveryReceipt">
<soap:operation soapAction="" style="document"/>
<input>
<soap:header message="interface:NotifySOAPHeader" part="NotifySOAPHeader" use="literal">
</soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="SmsNotificationService">
<port name="SmsNotification" binding="tns:SmsNotificationBinding">
<soap:address location="http://xxx.xx.xxx.x:8088/axis2/services/SmsNotificationService/"/>
</port>
</service>
</definitions>
我会发布Axis2生成的代码和我的网络服务实施代码,以便他们回答我的问题。
SmsNotificationServiceMessageReceiverInOut.java
/**
* SmsNotificationServiceMessageReceiverInOut.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.7.1 Built on : Feb 20, 2016 (10:01:29 GMT)
*/
package com.nirvasoft.mabsms;
/**
* SmsNotificationServiceMessageReceiverInOut message receiver
*/
public class SmsNotificationServiceMessageReceiverInOut extends org.apache.axis2.receivers.AbstractInOutMessageReceiver {
public void invokeBusinessLogic(
org.apache.axis2.context.MessageContext msgContext,
org.apache.axis2.context.MessageContext newMsgContext)
throws org.apache.axis2.AxisFault {
try {
// get the implementation class for the Web Service
Object obj = getTheImplementationObject(msgContext);
SmsNotificationServiceSkeleton skel = (SmsNotificationServiceSkeleton) obj;
//Out Envelop
org.apache.axiom.soap.SOAPEnvelope envelope = null;
//Find the axisOperation that has been set by the Dispatch phase.
org.apache.axis2.description.AxisOperation op = msgContext.getOperationContext()
.getAxisOperation();
if (op == null) {
throw new org.apache.axis2.AxisFault(
"Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
}
java.lang.String methodName;
if ((op.getName() != null) &&
((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJavaIdentifier(
op.getName().getLocalPart())) != null)) {
if ("notifySmsDeliveryReceipt".equals(methodName)) {
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE notifySmsDeliveryReceiptResponse3 =
null;
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptE wrappedParam =
(org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptE) fromOM(msgContext.getEnvelope()
.getBody()
.getFirstElement(),
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptE.class);
notifySmsDeliveryReceiptResponse3 = skel.notifySmsDeliveryReceipt(wrappedParam);
envelope = toEnvelope(getSOAPFactory(msgContext),
notifySmsDeliveryReceiptResponse3, false,
new javax.xml.namespace.QName(
"http://www.csapi.org/schema/parlayx/sms/notification/v3_1/local",
"notifySmsDeliveryReceiptResponse"));
} else
if ("notifySmsReception".equals(methodName)) {
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionResponseE notifySmsReceptionResponse6 =
null;
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionE wrappedParam =
(org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionE) fromOM(msgContext.getEnvelope()
.getBody()
.getFirstElement(),
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionE.class);
notifySmsReceptionResponse6 = skel.notifySmsReception(wrappedParam);
envelope = toEnvelope(getSOAPFactory(msgContext),
notifySmsReceptionResponse6, false,
new javax.xml.namespace.QName(
"http://www.csapi.org/schema/parlayx/sms/notification/v3_1/local",
"notifySmsReceptionResponse"));
} else {
throw new java.lang.RuntimeException("method not found");
}
newMsgContext.setEnvelope(envelope);
}
} catch (java.lang.Exception e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
//
private org.apache.axiom.om.OMElement toOM(
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptE param,
boolean optimizeContent) throws org.apache.axis2.AxisFault {
try {
return param.getOMElement(org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptE.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch (org.apache.axis2.databinding.ADBException e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
private org.apache.axiom.om.OMElement toOM(
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE param,
boolean optimizeContent) throws org.apache.axis2.AxisFault {
try {
return param.getOMElement(org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch (org.apache.axis2.databinding.ADBException e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
private org.apache.axiom.om.OMElement toOM(
org.csapi.www.schema.parlayx.common.v3_1.NotifySOAPHeaderE param,
boolean optimizeContent) throws org.apache.axis2.AxisFault {
try {
return param.getOMElement(org.csapi.www.schema.parlayx.common.v3_1.NotifySOAPHeaderE.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch (org.apache.axis2.databinding.ADBException e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
private org.apache.axiom.om.OMElement toOM(
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionE param,
boolean optimizeContent) throws org.apache.axis2.AxisFault {
try {
return param.getOMElement(org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionE.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch (org.apache.axis2.databinding.ADBException e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
private org.apache.axiom.om.OMElement toOM(
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionResponseE param,
boolean optimizeContent) throws org.apache.axis2.AxisFault {
try {
return param.getOMElement(org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionResponseE.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch (org.apache.axis2.databinding.ADBException e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
org.apache.axiom.soap.SOAPFactory factory,
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE param,
boolean optimizeContent, javax.xml.namespace.QName elementQName)
throws org.apache.axis2.AxisFault {
try {
org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
emptyEnvelope.getBody()
.addChild(param.getOMElement(
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE.MY_QNAME,
factory));
return emptyEnvelope;
} catch (org.apache.axis2.databinding.ADBException e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
private org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE wrapnotifySmsDeliveryReceipt() {
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE wrappedElement =
new org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE();
return wrappedElement;
}
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
org.apache.axiom.soap.SOAPFactory factory,
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionResponseE param,
boolean optimizeContent, javax.xml.namespace.QName elementQName)
throws org.apache.axis2.AxisFault {
try {
org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
emptyEnvelope.getBody()
.addChild(param.getOMElement(
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionResponseE.MY_QNAME,
factory));
return emptyEnvelope;
} catch (org.apache.axis2.databinding.ADBException e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
private org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionResponseE wrapnotifySmsReception() {
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionResponseE wrappedElement =
new org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionResponseE();
return wrappedElement;
}
/**
* get the default envelope
*/
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
org.apache.axiom.soap.SOAPFactory factory) {
return factory.getDefaultEnvelope();
}
private java.lang.Object fromOM(org.apache.axiom.om.OMElement param,
java.lang.Class type) throws org.apache.axis2.AxisFault {
try {
if (org.csapi.www.schema.parlayx.common.v3_1.NotifySOAPHeaderE.class.equals(
type)) {
return org.csapi.www.schema.parlayx.common.v3_1.NotifySOAPHeaderE.Factory.parse(param.getXMLStreamReaderWithoutCaching());
}
if (org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptE.class.equals(
type)) {
return org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptE.Factory.parse(param.getXMLStreamReaderWithoutCaching());
}
if (org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE.class.equals(
type)) {
return org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE.Factory.parse(param.getXMLStreamReaderWithoutCaching());
}
if (org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionE.class.equals(
type)) {
return org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionE.Factory.parse(param.getXMLStreamReaderWithoutCaching());
}
if (org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionResponseE.class.equals(
type)) {
return org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionResponseE.Factory.parse(param.getXMLStreamReaderWithoutCaching());
}
} catch (java.lang.Exception e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
return null;
}
private org.apache.axis2.AxisFault createAxisFault(java.lang.Exception e) {
org.apache.axis2.AxisFault f;
Throwable cause = e.getCause();
if (cause != null) {
f = new org.apache.axis2.AxisFault(e.getMessage(), cause);
} else {
f = new org.apache.axis2.AxisFault(e.getMessage());
}
return f;
}
} //end of class
SmsNotificationServiceSkeleton.java
/**
* SmsNotificationServiceSkeleton.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.7.1 Built on : Feb 20, 2016 (10:01:29 GMT)
*/
package com.nirvasoft.mabsms;
import org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE;
/**
* SmsNotificationServiceSkeleton java skeleton for the axisService
*/
public class SmsNotificationServiceSkeleton {
/**
* Auto generated method signature
*
* @param notifySmsDeliveryReceipt
* @return notifySmsDeliveryReceiptResponse
*/
public org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptResponseE notifySmsDeliveryReceipt(
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsDeliveryReceiptE notifySmsDeliveryReceipt) {
System.out.println("correlator = " + notifySmsDeliveryReceipt.getNotifySmsDeliveryReceipt().getCorrelator());
System.out.println("Status = " + notifySmsDeliveryReceipt.getNotifySmsDeliveryReceipt().getDeliveryStatus().toString());
return new NotifySmsDeliveryReceiptResponseE();
}
/**
* Auto generated method signature
*
* @param notifySmsReception
* @return notifySmsReceptionResponse
*/
public org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionResponseE notifySmsReception(
org.csapi.www.schema.parlayx.sms.notification.v3_1.local.NotifySmsReceptionE notifySmsReception) {
//TODO : fill this with the necessary business logic
throw new java.lang.UnsupportedOperationException("Please implement " +
this.getClass().getName() + "#notifySmsReception");
}
}
远程服务器调用notifySmsDeliveryReceipt
。我想知道远程调用的详细信息会有所帮助,我希望任何知道Axis2的人都能指出他们在我的代码中看到的任何问题。