You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by de...@iwon.com on 2004/06/02 01:36:52 UTC

RE: help with Axis fault

 Hi,
don't know if this helps, I'm a newbie too. I'm able to get your
web service to work. I did the following

1. Your web service is similar to the 
%AXIS_HOME%/samples/userguide/example3. I just updated the 
Myservice.java to include your new api. I have attached a
copy to the email.

2. Recompiled the Myservice.java file
javac -classpath %CLASSPATH% MyService.java

Copied the new files to 
%TOMCAT_HOME%/webapps/axis/Web-inf/classes/samples/userguide/example3

3. Deployed the web serivce 
java -classpath %CLASSPATH% org.apache.axis.client.AdminClient deploy.wsdd

4. Modified your client.jsp and placed it in
%TOMCAT_HOME%/webapps/axis/client.jsp

I have attached a copy. Ran the file from the browser and got
the following output 

samples.userguide.example3.MyService -> p_selectedMonth=31 p_selectedYear=2004 p_timeZone=EST

I using axis 1.1, tomcat 4.1.29, windows nt server




 --- On Sat 05/29, Dave Jacobson < dave_jacobson@hotmail.com > wrote:
From: Dave Jacobson [mailto: dave_jacobson@hotmail.com]
To: axis-user@ws.apache.org
Date: Sat, 29 May 2004 13:07:47 -0400
Subject: help with Axis fault

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></style>
</head>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>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...</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>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...</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>Here's the deal:</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>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.</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>I attached:</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>- tcpmon input and output</font></div>
<DIV><FONT face=Arial size=2>- client code</font></div>
<DIV><FONT face=Arial size=2>- wsdl file</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>If there are other things that would be helpful to 
include I would be glad to post additional info...</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>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.</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>Here is the input as recorded by 
TCPMonitor:</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face="Courier New" size=1>POST /axis/services/MyService 
HTTP/1.0</font></div>
<DIV><FONT face="Courier New" size=1>Content-Type: text/xml; 
charset=utf-8</font></div>
<DIV><FONT face="Courier New" size=1>Accept: application/soap+xml, 
application/dime, multipart/related, text/*</font></div>
<DIV><FONT face="Courier New" size=1>User-Agent: Axis/1.1</font></div>
<DIV><FONT face="Courier New" size=1>Host: localhost</font></div>
<DIV><FONT face="Courier New" size=1>Cache-Control: no-cache</font></div>
<DIV><FONT face="Courier New" size=1>Pragma: no-cache</font></div>
<DIV><FONT face="Courier New" size=1>SOAPAction: ""</font></div>
<DIV><FONT face="Courier New" size=1>Content-Length: 558</font></div>
<DIV><FONT face="Courier New" size=1></font> </div>
<DIV><FONT face="Courier New" size=1><?xml version="1.0" 
encoding="UTF-8"?><BR><soapenv:Envelope xmlns:soapenv="</font><A 
href="http://schemas.xmlsoap.org/soap/envelope/"><FONT face="Courier New" 
size=1>http://schemas.xmlsoap.org/soap/envelope/</font></a><FONT 
face="Courier New" size=1>" xmlns:xsd="</font><A 
href="http://www.w3.org/2001/XMLSchema"><FONT face="Courier New" 
size=1>http://www.w3.org/2001/XMLSchema</font></a><FONT face="Courier New" 
size=1>" xmlns:xsi="</font><A 
href="http://www.w3.org/2001/XMLSchema-instance"><FONT face="Courier New" 
size=1>http://www.w3.org/2001/XMLSchema-instance</font></a><FONT 
face="Courier New" size=1>"><BR> <soapenv:Body><BR>  
<ns1:testOperationName soapenv:encodingStyle="</font><A 
href="http://schemas.xmlsoap.org/soap/encoding/"><FONT face="Courier New" 
size=1>http://schemas.xmlsoap.org/soap/encoding/</font></a><FONT 
face="Courier New" size=1>" xmlns:ns1="MyService"><BR>   <sMonth 
xsi:type="xsd:string">3</sMonth><BR>   <sYear 
xsi:type="xsd:string">2004</sYear><BR>   <sTimeZone 
xsi:type="xsd:string">EST</sTimeZone><BR>  
</ns1:testOperationName><BR> </soapenv:Body><BR></soapenv:Envelope></font></div>
<DIV><FONT face="Courier New" size=1></font> </div>
<DIV><FONT face=Arial size=2>and here is the output as recorded by 
TCPMonitor:</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face="Courier New" size=1>HTTP/1.1 500 Internal Server 
Error</font></div>
<DIV><FONT face="Courier New" size=1>Content-Type: 
text/xml;charset=utf-8</font></div>
<DIV><FONT face="Courier New" size=1>Date: Sat, 29 May 2004 16:31:58 
GMT</font></div>
<DIV><FONT face="Courier New" size=1>Server: Apache-Coyote/1.1</font></div>
<DIV><FONT face="Courier New" size=1>Connection: close</font></div>
<DIV><FONT face="Courier New" size=1></font> </div>
<DIV><FONT face="Courier New" size=1><?xml version="1.0" 
encoding="UTF-8"?><BR><soapenv:Envelope xmlns:soapenv="</font><A 
href="http://schemas.xmlsoap.org/soap/envelope/"><FONT face="Courier New" 
size=1>http://schemas.xmlsoap.org/soap/envelope/</font></a><FONT 
face="Courier New" size=1>" xmlns:xsd="</font><A 
href="http://www.w3.org/2001/XMLSchema"><FONT face="Courier New" 
size=1>http://www.w3.org/2001/XMLSchema</font></a><FONT face="Courier New" 
size=1>" xmlns:xsi="</font><A 
href="http://www.w3.org/2001/XMLSchema-instance"><FONT face="Courier New" 
size=1>http://www.w3.org/2001/XMLSchema-instance</font></a><FONT 
face="Courier New" size=1>"><BR> <soapenv:Body><BR>  
<soapenv:Fault><BR>   
<faultcode>soapenv:Server.userException</faultcode><BR>   
<faultstring>java.lang.Exception</faultstring><BR>   
<detail/><BR>  
</soapenv:Fault><BR> </soapenv:Body><BR></soapenv:Envelope></font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>The client .jsp code looks like this:</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face="Courier New" size=1><%@ page language="java" 
org.apache.axis.client.Call, org.apache.axis.client.Service, 
javax.xml.namespace.QName, org.apache.axis.AxisFault" %><BR><%@ page 
import="java.util.*" %><BR></font></div>
<DIV><FONT face="Courier New" size=1><%<BR></font><FONT face="Courier New" 
size=1>String sRetrieve =  request.getParameter("retrieve");<BR>String 
sReturn = "";<BR>String sMonth = "3";<BR>String sYear = "2004";<BR></font></div>
<DIV><FONT face="Courier New" size=1>//This is the URL of the webservice on my 
PC<BR>String sEndpoint = "</font><A 
href="http://localhost:8081/axis/services/MyService"><FONT face="Courier New" 
size=1>http://localhost:8081/axis/services/MyService</font></a><FONT 
face="Courier New" size=1>";<BR><BR></font><FONT face="Courier New" 
size=1> Service  service = new 
Service();<BR> Call     call    = (Call) 
service.createCall();</font></div>
<DIV><FONT face="Courier New" size=1></font> </div>
<DIV><FONT face="Courier New" size=1> call.removeAllParameters() 
;<BR> call.setReturnType( org.apache.axis.Constants.XSD_STRING 
);<BR> call.setTargetEndpointAddress( new java.net.URL( sEndpoint ) 
);<BR> call.setOperationName(new QName("MyService", "testOperationName") 
);<BR> call.addParameter("sMonth", org.apache.axis.Constants.XSD_STRING, 
javax.xml.rpc.ParameterMode.IN);<BR> call.addParameter("sYear", 
org.apache.axis.Constants.XSD_STRING, 
javax.xml.rpc.ParameterMode.IN);<BR> call.addParameter("sTimeZone", 
org.apache.axis.Constants.XSD_STRING, 
javax.xml.rpc.ParameterMode.IN);<BR> sReturn = (String) call.invoke( new 
Object[] { sMonth, sYear, "EST" } );<BR>%></font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>Here is what the wsdl looks like at <A 
href="http://localhost:8081/axis/services/MyService?wsdl">http://localhost:8081/axis/services/MyService?wsdl</a></font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face="Courier New" size=1>  <?xml version="1.0" 
encoding="UTF-8" ?> <BR>- <wsdl:definitions targetNamespace="</font><A 
href="http://localhost/axis/services/MyService"><FONT face="Courier New" 
size=1>http://localhost/axis/services/MyService</font></a><FONT 
face="Courier New" size=1>" xmlns="</font><A 
href="http://schemas.xmlsoap.org/wsdl/"><FONT face="Courier New" 
size=1>http://schemas.xmlsoap.org/wsdl/</font></a><FONT face="Courier New" 
size=1>" xmlns:apachesoap="</font><A href="http://xml.apache.org/xml-soap"><FONT 
face="Courier New" size=1>http://xml.apache.org/xml-soap</font></a><FONT 
face="Courier New" size=1>" xmlns:impl="</font><A 
href="http://localhost/axis/services/MyService"><FONT face="Courier New" 
size=1>http://localhost/axis/services/MyService</font></a><FONT 
face="Courier New" size=1>" xmlns:intf="</font><A 
href="http://localhost/axis/services/MyService"><FONT face="Courier New" 
size=1>http://localhost/axis/services/MyService</font></a><FONT 
face="Courier New" size=1>" xmlns:soapenc="</font><A 
href="http://schemas.xmlsoap.org/soap/encoding/"><FONT face="Courier New" 
size=1>http://schemas.xmlsoap.org/soap/encoding/</font></a><FONT 
face="Courier New" size=1>" xmlns:tns1="</font><A 
href="http://programName.companyName.com"><FONT face="Courier New" 
size=1>http://programName.companyName.com</font></a><FONT face="Courier New" 
size=1>" xmlns:tns2="</font><A href="http://companyName.com"><FONT 
face="Courier New" size=1>http://companyName.com</font></a><FONT 
face="Courier New" size=1>" xmlns:tns3="</font><A 
href="http://functionName.companyName.com"><FONT face="Courier New" 
size=1>http://functionName.companyName.com</font></a><FONT face="Courier New" 
size=1>" xmlns:wsdl="</font><A href="http://schemas.xmlsoap.org/wsdl/"><FONT 
face="Courier New" size=1>http://schemas.xmlsoap.org/wsdl/</font></a><FONT 
face="Courier New" size=1>" xmlns:wsdlsoap="</font><A 
href="http://schemas.xmlsoap.org/wsdl/soap/"><FONT face="Courier New" 
size=1>http://schemas.xmlsoap.org/wsdl/soap/</font></a><FONT face="Courier New" 
size=1>" xmlns:xsd="</font><A href="http://www.w3.org/2001/XMLSchema"><FONT 
face="Courier New" size=1>http://www.w3.org/2001/XMLSchema</font></a><FONT 
face="Courier New" size=1>"><BR>- <wsdl:types><BR>- <schema 
targetNamespace="</font><A href="http://programName.companyName.com"><FONT 
face="Courier New" size=1>http://programName.companyName.com</font></a><FONT 
face="Courier New" size=1>" xmlns="</font><A 
href="http://www.w3.org/2001/XMLSchema"><FONT face="Courier New" 
size=1>http://www.w3.org/2001/XMLSchema</font></a><FONT face="Courier New" 
size=1>"><BR>  <import namespace="</font><A 
href="http://schemas.xmlsoap.org/soap/encoding/"><FONT face="Courier New" 
size=1>http://schemas.xmlsoap.org/soap/encoding/</font></a><FONT 
face="Courier New" size=1>" /> <BR>- <complexType 
name="ClassName"><BR>- <sequence><BR>  <element 
name="BVariable" type="xsd:boolean" /> <BR>  </sequence><BR>  
</complexType><BR>  </schema><BR>  
</wsdl:types><BR>- <wsdl:message 
name="testOperationNameRequest"><BR>  <wsdl:part 
name="p_selectedMonth" type="xsd:string" /> <BR>  <wsdl:part 
name="p_selectedYear" type="xsd:string" /> <BR>  <wsdl:part 
name="p_timeZone" type="xsd:string" /> <BR>  </wsdl:message><BR>- 
<wsdl:message name="testOperationNameResponse"><BR>  <wsdl:part 
name="testOperationNameReturn" type="xsd:string" /> <BR>  
</wsdl:message><BR>- <wsdl:operation name="testOperationName" 
parameterOrder="p_selectedMonth p_selectedYear p_timeZone"><BR>  
<wsdl:input message="impl:testOperationNameRequest" 
name="testOperationNameRequest" /> <BR>  <wsdl:output 
message="impl:testOperationNameResponse" name="testOperationNameResponse" /> 
<BR>  </wsdl:operation><BR>- <wsdl:operation 
name="testOperationName"><BR>  <wsdlsoap:operation soapAction="" 
/> <BR>- <wsdl:input name="testOperationNameRequest"><BR>  
<wsdlsoap:body encodingStyle="</font><A 
href="http://schemas.xmlsoap.org/soap/encoding/"><FONT face="Courier New" 
size=1>http://schemas.xmlsoap.org/soap/encoding/</font></a><FONT 
face="Courier New" size=1>" namespace="</font><A 
href="http://programName.companyName.com"><FONT face="Courier New" 
size=1>http://programName.companyName.com</font></a><FONT face="Courier New" 
size=1>" use="encoded" /> <BR>  </wsdl:input><BR>- <wsdl:output 
name="testOperationNameResponse"><BR>  <wsdlsoap:body 
encodingStyle="</font><A href="http://schemas.xmlsoap.org/soap/encoding/"><FONT 
face="Courier New" 
size=1>http://schemas.xmlsoap.org/soap/encoding/</font></a><FONT 
face="Courier New" size=1>" namespace="</font><A 
href="http://localhost/axis/services/MyService"><FONT face="Courier New" 
size=1>http://localhost/axis/services/MyService</font></a><FONT 
face="Courier New" size=1>" use="encoded" /> <BR>  
</wsdl:output><BR>  </wsdl:operation><BR>  
</wsdl:definitions></font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>(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.)</font></div>
<DIV><FONT face=Arial size=2></font> </div>
<DIV><FONT face=Arial size=2>Thanks in advance,</font></div>
<DIV><FONT face=Arial size=2>Dave</font></div></body></html>
<p>

_______________________________________________