Your server is generating invalid XML. minOccurs="0" means that the
element can be left out of the XML document, but if the element is
present the content must match the TimeStampType. The empty string does
not match this type, even ignoring the regular expression part, because
the type definition says the string must be exactly 14 characters in
length (minLength==maxLength==14).
- Dennis
--
Dennis M. Sosnoski
SOA and Web Services in Java
Axis2 Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
ChunTung POON wrote:
An update about the case
Here is the Time Stamp Type
===================
<xsd:simpleType name="TimeStampType">
<xsd:restriction base="xsd:string">
<xsd:minLength value="14"/>
<xsd:maxLength value="14"/>
<xsd:pattern value="^[0-9]{14,14}$"/>
</xsd:restriction>
</xsd:simpleType>
===================
<xsd:element name="TimeStamp" type="smscmn:TimeStampType"
maxOccurs="1" minOccurs="0"/>
===================
the response for the timestamp is
<ns4:TimeStamp></ns4:TimeStamp>
is it still valid?
2009/5/6 ChunTung POON
Hi All,
I am running my client on java 1.4 with axis2 1.4.1
I am able to send the server message. However, axis2 seems like cannot
construct the response from the soap message the server replied.
Following exception occurred when the client tried to construct the
response from the soap message.
It was caused the by axis2 cannot set the timestamp of the message.
When I look at the the soap xml. The Timestamp is
<ns4:TimeStamp></ns4:TimeStamp>
and when i check the schema of the response message.
<xsd:element name="TimeStamp" type="smscmn:TimeStampType"
maxOccurs="1" minOccurs="0"/>
Its minOccurs="0" is correct. So, is axis2 cannot handle timestamp
having minOccurs=0 ? or Did I do something wrong?
thanks,
Chun Tung
org.apache.axis2.AxisFault
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at
xxxx.sdp.ws.sms.wsdl.send.SmsSendServiceStub.fromOM(SmsSendServiceStub.java:12211)
at
xxxx.sdp.ws.sms.wsdl.send.SmsSendServiceStub.SendSms(SmsSendServiceStub.java:209)
at testM1wb.main(testM1wb.java:85)
Caused by: java.lang.RuntimeException
at
xxxx.sdp.ws.sms.wsdl.send.SmsSendServiceStub$TimeStampType.setTimeStampType(SmsSendServiceStub.java:7957)
at
xxxx.sdp.ws.sms.wsdl.send.SmsSendServiceStub$TimeStampType$Factory.parse(SmsSendServiceStub.java:8311)
at
xxxx.sdp.ws.sms.wsdl.send.SmsSendServiceStub$DestinationResponseType$Factory.parse(SmsSendServiceStub.java:11050)
at
xxxx.sdp.ws.sms.wsdl.send.SmsSendServiceStub$DestinationResponseListType$Factory.parse(SmsSendServiceStub.java:5132)
at
xxxx.sdp.ws.sms.wsdl.send.SmsSendServiceStub$SendSmsResponseType$Factory.parse(SmsSendServiceStub.java:5925)
at
xxxx.sdp.ws.sms.wsdl.send.SmsSendServiceStub$SendSmsResponseElement$Factory.parse(SmsSendServiceStub.java:7532)
at
xxxx.sdp.ws.sms.wsdl.send.SmsSendServiceStub.fromOM(SmsSendServiceStub.java:12191)
... 2 more
Exception in thread "main"
Here is the soap response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns4:SendSmsResponseElement xmlns="http://xxxx/sdp/ws/sms/wsdl/acm"
xmlns:ns2="http://xxxx/sdp/ws/sms/wsdl/header"
xmlns:ns3="http://xxxx/sdp/ws/sms/wsdl/application"
xmlns:ns4="http://xxxx/sdp/ws/sms/wsdl/send"
xmlns:ns5="http://xxxx/sdp/ws/sms/wsdl/common"
xmlns:ns6="http://xxxx/sdp/ws/sms/wsdl/error">
<ns4:MessageId>109050614180004</ns4:MessageId>
<ns4:StatusCode>4001</ns4:StatusCode>
<ns4:StatusDetail>System.</ns4:StatusDetail>
<ns4:DestinationResponses><ns4:destinationResponse>
<ns4:Destination></ns4:Destination>
<ns4:TimeStamp></ns4:TimeStamp>
<ns4:MessageId></ns4:MessageId>
<ns4:StatusCode></ns4:StatusCode>
<ns4:StatusDetail></ns4:StatusDetail>
</ns4:destinationResponse></ns4:DestinationResponses>
</ns4:SendSmsResponseElement>
</soap:Body>
</soap:Envelope>
XSD
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:smscmn="http://xxxx/sdp/ws/sms/wsdl/common"
xmlns:app="http://xxxx/sdp/ws/sms/wsdl/application"
xmlns:tns="http://xxxx/sdp/ws/sms/wsdl/deliver"
targetNamespace="http://xxxx/sdp/ws/sms/wsdl/deliver"
elementFormDefault="qualified">
<xsd:import namespace="http://xxxx/sdp/ws/sms/wsdl/application"
schemaLocation="Application-Definitions.xsd" />
<xsd:import namespace="http://xxxx/sdp/ws/sms/wsdl/common"
schemaLocation="SMS-Common-Definitions.xsd"/>
<xsd:complexType name="SegmentListType">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="1" name="segment"
type="smscmn:SegmentType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DeliverSmsRequestType">
<xsd:sequence>
<xsd:element name="Destination" type="xsd:string" maxOccurs="1"
minOccurs="0"/>
<xsd:element name="SourceAddress" type="xsd:string"
maxOccurs="1" minOccurs="1"/>
<xsd:element name="Encoding" type="smscmn:SmsEncodingType"/>
<xsd:element name="Segment" type="smscmn:SegmentType"
maxOccurs="1" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DeliverSmsResponseType">
<xsd:sequence>
<xsd:element name="StatusCode" type="xsd:string" maxOccurs="1"
minOccurs="1"/>
<xsd:element name="StatusDetail" type="xsd:string" maxOccurs="1"
minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SmsDeliveryStatusType">
<xsd:sequence>
<xsd:element name="Destination" type="smscmn:MSISDNType"/>
<xsd:element name="Application" type="app:ApplicationType"
maxOccurs="1" minOccurs="1"/>
<xsd:element name="TimeStamp" type="smscmn:TimeStampType"
maxOccurs="1" minOccurs="0"/>
<xsd:element name="MessageId" type="xsd:string" maxOccurs="1"
minOccurs="0"/>
<xsd:element name="Status" type="smscmn:StatusType"
maxOccurs="1" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="DeliverSmsRequestElement"
type="tns:DeliverSmsRequestType"/>
<xsd:element name="DeliverSmsResponseElement"
type="tns:DeliverSmsResponseType"/>
<xsd:element name="SmsDeliveryStatusElement"
type="tns:SmsDeliveryStatusType"/>
<xsd:element name="SDPError" type="smscmn:SDPError"/>
</xsd:schema>