axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Jacobson" <dave_jacob...@hotmail.com>
Subject help with Axis fault
Date Sat, 29 May 2004 17:07:47 GMT
Hi,

OK, I've been working on this for...well, I'm embarrassed to say exactly how long, but, needless
to say, I've been working on this for a while...

I'm a major newbie to the whole environment so my error is probably a basic one but one that
I can nevertheless figure out.  I would be quite grateful to anyone who could assist...

Here's the deal:

I am just trying to create a test web service.  I have successfully run the userguide examples
but I can't get my own web service to run.  I have a .jsp script on the client side that calls
a web service.  The web service operation returns a string but I am getting an axis fault
error message.  I think the problem has to do with the namespace.  I am only running this
on localhost.  I wasn't sure what to put for the namespace.

I attached:

- tcpmon input and output
- client code
- wsdl file

If there are other things that would be helpful to include I would be glad to post additional
info...

I ran tcpmon on the port that I deployed the web service.  I was running everything on port
8081 but to setup TCPMonitor I deployed the web service on port 8081 and then configured Tomcat
to run on port 4200.  Then I target the browser to port 4200 and TCPMonitor redirects the
web page to port 8081.  At least that is what I hope it is doing.

Here is the input as recorded by TCPMonitor:

POST /axis/services/MyService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.1
Host: localhost
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 558

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <ns1:testOperationName soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="MyService">
   <sMonth xsi:type="xsd:string">3</sMonth>
   <sYear xsi:type="xsd:string">2004</sYear>
   <sTimeZone xsi:type="xsd:string">EST</sTimeZone>
  </ns1:testOperationName>
 </soapenv:Body>
</soapenv:Envelope>

and here is the output as recorded by TCPMonitor:

HTTP/1.1 500 Internal Server Error
Content-Type: text/xml;charset=utf-8
Date: Sat, 29 May 2004 16:31:58 GMT
Server: Apache-Coyote/1.1
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <soapenv:Fault>
   <faultcode>soapenv:Server.userException</faultcode>
   <faultstring>java.lang.Exception</faultstring>
   <detail/>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>

The client .jsp code looks like this:

<%@ page language="java" org.apache.axis.client.Call, org.apache.axis.client.Service, javax.xml.namespace.QName,
org.apache.axis.AxisFault" %>
<%@ page import="java.util.*" %>

<%
String sRetrieve =  request.getParameter("retrieve");
String sReturn = "";
String sMonth = "3";
String sYear = "2004";

//This is the URL of the webservice on my PC
String sEndpoint = "http://localhost:8081/axis/services/MyService";

 Service  service = new Service();
 Call     call    = (Call) service.createCall();

 call.removeAllParameters() ;
 call.setReturnType( org.apache.axis.Constants.XSD_STRING );
 call.setTargetEndpointAddress( new java.net.URL( sEndpoint ) );
 call.setOperationName(new QName("MyService", "testOperationName") );
 call.addParameter("sMonth", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
 call.addParameter("sYear", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
 call.addParameter("sTimeZone", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
 sReturn = (String) call.invoke( new Object[] { sMonth, sYear, "EST" } );
%>

Here is what the wsdl looks like at http://localhost:8081/axis/services/MyService?wsdl

  <?xml version="1.0" encoding="UTF-8" ?> 
- <wsdl:definitions targetNamespace="http://localhost/axis/services/MyService" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost/axis/services/MyService"
xmlns:intf="http://localhost/axis/services/MyService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://programName.companyName.com" xmlns:tns2="http://companyName.com" xmlns:tns3="http://functionName.companyName.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <schema targetNamespace="http://programName.companyName.com" xmlns="http://www.w3.org/2001/XMLSchema">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
- <complexType name="ClassName">
- <sequence>
  <element name="BVariable" type="xsd:boolean" /> 
  </sequence>
  </complexType>
  </schema>
  </wsdl:types>
- <wsdl:message name="testOperationNameRequest">
  <wsdl:part name="p_selectedMonth" type="xsd:string" /> 
  <wsdl:part name="p_selectedYear" type="xsd:string" /> 
  <wsdl:part name="p_timeZone" type="xsd:string" /> 
  </wsdl:message>
- <wsdl:message name="testOperationNameResponse">
  <wsdl:part name="testOperationNameReturn" type="xsd:string" /> 
  </wsdl:message>
- <wsdl:operation name="testOperationName" parameterOrder="p_selectedMonth p_selectedYear
p_timeZone">
  <wsdl:input message="impl:testOperationNameRequest" name="testOperationNameRequest" />

  <wsdl:output message="impl:testOperationNameResponse" name="testOperationNameResponse"
/> 
  </wsdl:operation>
- <wsdl:operation name="testOperationName">
  <wsdlsoap:operation soapAction="" /> 
- <wsdl:input name="testOperationNameRequest">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://programName.companyName.com"
use="encoded" /> 
  </wsdl:input>
- <wsdl:output name="testOperationNameResponse">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/axis/services/MyService"
use="encoded" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:definitions>

(Note that I removed a bunch of things from the wsdl file that were not related to this operation.
 I hope I didn't remove something necessary to decipher what the problem is.)

Thanks in advance,
Dave
Mime
View raw message