Hi, I am having problem calling a web service in ALSB with Axis2 1.3. The
error I get is "org.apache.axis2.AxisFault:
com.ctc.wstx.exc.WstxParsingException: Expected a text token, got
START_ELEMENT", the stack trace is below. I couldn't find anything when I
searched the archives, have anyone else had this problem in the past?
org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxParsingException: Expected
a text token, got START_ELEMENT.
at [row,col {unknown-source}]: [2,224]
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
at com.alsb.www.CalculateTaxServiceStub.fromOM(
CalculateTaxServiceStub.java:296)
at com.alsb.www.CalculateTaxServiceStub.calculateTax(
CalculateTaxServiceStub.java:146)
at com.sample.TaxServiceClient.main(TaxServiceClient.java:22)
Caused by: org.apache.axiom.om.impl.exception.OMStreamingException:
com.ctc.wstx.exc.WstxParsingException: Expected a text token, got
START_ELEMENT.
at [row,col {unknown-source}]: [2,224]
at org.apache.axiom.om.impl.llom.OMStAXWrapper.getElementText(
OMStAXWrapper.java:847)
at
com.alsb.www.CalculateTaxServiceStub$CalculateTaxResponse$Factory.parse(
CalculateTaxServiceStub.java:698)
at com.alsb.www.CalculateTaxServiceStub.fromOM(
CalculateTaxServiceStub.java:293)
... 2 more
Caused by: com.ctc.wstx.exc.WstxParsingException: Expected a text token, got
START_ELEMENT.
at [row,col {unknown-source}]: [2,224]
at com.ctc.wstx.sr.StreamScanner.constructWfcException(
StreamScanner.java:605)
at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:461)
at com.ctc.wstx.sr.BasicStreamReader.getElementText(
BasicStreamReader.java:677)
at org.apache.axiom.om.impl.llom.OMStAXWrapper.getElementText(
OMStAXWrapper.java:845)
... 4 more
The WSDL is pretty simple (a sample from the book "Definitive Guide to SOA -
BEA ALSB")
<?xml version="1.0" encoding="utf-8"?>
<s0:definitions name="AdvancedMessageFlowServiceDefinitions"
targetNamespace="http://www.alsb.com" xmlns:s0="
http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://www.alsb.com" xmlns:s2="
http://schemas.xmlsoap.org/wsdl/soap/">
<s0:types>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="http://www.alsb.com"
xmlns:alsb="http://www.alsb.com" xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="
http://www.w3.org/2001/XMLSchema">
<!-- TIP: Start your element names off lower case. This will more
closely match the
Java naming conventions when you generate the code -->
<xs:element name="calculateTaxRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="taxableAmount" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="calculateTaxResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="result" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</s0:types>
<s0:message name="calculateTaxRequest">
<s0:part element="s1:calculateTaxRequest" name="parameters"/>
</s0:message>
<s0:message name="calculateTaxResponse">
<s0:part element="s1:calculateTaxResponse" name="parameters"/>
</s0:message>
<s0:portType name="EJBTaxProxy">
<s0:operation name="calculateTax" parameterOrder="parameters">
<s0:input message="s1:calculateTaxRequest"/>
<s0:output message="s1:calculateTaxResponse"/>
</s0:operation>
</s0:portType>
<s0:binding name="EJBTaxProxySoapBinding" type="s1:EJBTaxProxy">
<s2:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
<s0:operation name="calculateTax">
<s2:operation soapAction="" style="document"/>
<s0:input>
<s2:body parts="parameters" use="literal"/>
</s0:input>
<s0:output>
<s2:body parts="parameters" use="literal"/>
</s0:output>
</s0:operation>
</s0:binding>
<s0:service name="CalculateTaxService">
<s0:port binding="s1:EJBTaxProxySoapBinding" name="EJBTaxSoapPort">
<s2:address location="http://localhost:7001/EJBTaxProxy"/>
</s0:port>
</s0:service>
</s0:definitions>
I generate the proxy client code with these options:
wsdl2java -o C:\Temp\Axis -s -p com.alsb.www -uri C:\EJBTaxProxy.xml
My client code looks like this:
try {
CalculateTaxServiceStub stub = new
CalculateTaxServiceStub();
double amount = 25;
CalculateTaxRequest request = new CalculateTaxRequest();
request.setTaxableAmount(amount);
CalculateTaxResponse response = stub.calculateTax(request);
if(response != null) {
System.out.println(response.getResult());
}
}
catch (AxisFault e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
I get the exception when I call stub.calculateTax. Does anyone have any
ideas what I should look for to resolve the issue?
TIA,
Magnus