From: dexterwong <nu...@jb...> - 2004-09-30 12:57:29
|
Hi, I deployed the samples-server-web.war to the default server running on jboss-4.0.0DR2 (windows xp).Using a browser I can see the web service from http://localhost:8080/ws4ee/services. I'm having problems invoking the web service from a my client programs, ex 1) My client code looks like import javax.xml.namespace.QName; import javax.xml.rpc.*; import java.net.URL; import com.underworld.crimeportal.*; public class Test2 { public static void main(String []args) throws Exception { URL url = new URL("http://localhost:8081/samples-server-web/exactpath/jse?wsdl"); QName qname = new QName("http://com.underworld.crimeportal/ws4ee", "OrganizationServiceJSE"); ServiceFactory factory = ServiceFactory.newInstance(); Service service = factory.createService(url, qname); OrganizationEndpoint endpoint = (OrganizationEndpoint)service.getPort(OrganizationEndpoint.class); String info = endpoint.getContactInfo("mafia"); System.out.println(info); } } The output is C:\jboss-4.0.0RC1\dwong\output-samples\classes>java -classpath C:\jboss-4.0.0RC1 \dwong\output-samples\classes;%CLASSPATH% Test2 log4j:WARN No appenders could be found for logger (org.jboss.webservice.EngineCo nfigurationFinder). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.lang.reflect.UndeclaredThrowableException at $Proxy0.getContactInfo(Unknown Source) at Test2.main(Test2.java:17) Caused by: org.xml.sax.SAXException: SimpleDeserializer encountered a child elem ent, which is NOT expected, in something it was trying to deserialize. at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDe serializer.java:204) at org.apache.axis.encoding.DeserializationContextImpl.startElement(Dese rializationContextImpl.java:1181) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.ja va:244) at org.apache.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElem entAxisImpl.java:1409) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:264) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:398) at org.apache.axis.client.Call.invoke(Call.java:2605) at org.apache.axis.client.Call.invoke(Call.java:2487) at org.apache.axis.client.Call.invoke(Call.java:1948) at org.apache.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:25 1) ... 2 more The output from the jboss console window is 05:49:32,233 INFO [OrganizationEndpointImpl] init: org.apache.axis.transport.ht tp.ServletEndpointContextImpl@14886d3 05:49:32,243 INFO [OrganizationEndpointImpl] getContactInfo: 05:49:32,243 INFO [OrganizationEndpointImpl] destroy: org.apache.axis.transport .http.ServletEndpointContextImpl@14886d3 2) I create another client using axis1.2 beta. I take the server-web.wsdl and run WSDL2Java. I create the following file package crimeportal.underworld.com.ws4ee; public class Test { public static void main(String[] args) throws Exception { OrganizationServiceJSELocator loc = new OrganizationServiceJSELocator(); OrganizationEndpoint oep = loc.getOrganizationPort(new java.net.URL (args[0])); System.out.println(oep.getContactInfo("hi")); } } The output is C:\axis-1_2beta\samples\test\crimeportal\underworld\com\ws4ee>java -classpath C: \axis-1_2beta\samples\test;%CLASSPATH% crimeportal.underworld.com.ws4ee.Test htt p://localhost:8081/ws4ee/services/OrganizationServiceJSE log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR esourceBundle). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child e lement, which is NOT expected, in something it was trying to deserialize. faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Simple Deserializer encountered a child element, which is NOT expected, in something it was trying to deserialize. at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDe serializer.java:148) Using tcpmon I can see the request is ok, but the respone is strange. The soap body contains element with some encrypted data. HTTP/1.1 200 OK Set-Cookie: JSESSIONID=45B0E56815B17F7F5E2348029221934B; Path=/ws4ee Content-Type: text/xml; charset=utf-8;charset=utf-8 Date: Thu, 30 Sep 2004 12:49:10 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> <ns1:getContactInfoReturn xmlns:ns1="http://com.underworld.crimeportal/ws4ee"> VGhlICcnIGJvc3MgaXMgY3VycmVudGx5IG91dCBvZiBvZmZpY2UsIHBsZWFzZSBjYWxsIGFnYWluLg== </ns1:getContactInfoReturn> </soapenv:Body> </soapenv:Envelope> Does anyone have an example on writing a client that talks to a ws2ee document/literal web service? Any help greatly appreciated. -dwong View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3849986#3849986 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3849986 |