please help - web services still dont work for me - jboss as
wiggy Apr 1, 2008 9:34 PMthought i'd have one last go
downloaded jboss As5b4. configured eclipse 3.3 with default 5.0 server (basic one)
deployed ejb3 webservice as ejb file to server and checked wsdl generated. used wsconsume to gen client artifacts and imported into standalone application client project. All compiles.
client looks like this - cant get much easier
package test; import java.util.Hashtable; import javax.naming.InitialContext; import org.wstest.webservices.*; public class Test { /** * @param args */ public static void main(String[] args) throws Exception { InitialContext ctx; // TODO Auto-generated method stub HelloService s = new HelloService(); HelloServiceWS ws = s.getHelloServiceWSPort(); String res = ws.sayHello(); System.out.println ("test: returned " + res + " \n"); }
generated wsdl at server looks like
- <definitions name="HelloService" targetNamespace="http://webservices.wstest.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservices.wstest.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <types> - <xs:schema targetNamespace="http://webservices.wstest.org/" version="1.0" xmlns:tns="http://webservices.wstest.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="sayHello" type="tns:sayHello" /> <xs:element name="sayHelloResponse" type="tns:sayHelloResponse" /> - <xs:complexType name="sayHello"> <xs:sequence /> </xs:complexType> - <xs:complexType name="sayHelloResponse"> - <xs:sequence> <xs:element minOccurs="0" name="helloResult" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:schema> </types> - <message name="HelloServiceWS_sayHello"> <part element="tns:sayHello" name="sayHello" /> </message> - <message name="HelloServiceWS_sayHelloResponse"> <part element="tns:sayHelloResponse" name="sayHelloResponse" /> </message> - <portType name="HelloServiceWS"> - <operation name="sayHello" parameterOrder="sayHello"> <input message="tns:HelloServiceWS_sayHello" /> <output message="tns:HelloServiceWS_sayHelloResponse" /> </operation> </portType> - <binding name="HelloServiceWSBinding" type="tns:HelloServiceWS"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> - <operation name="sayHello"> <soap:operation soapAction="" /> - <input> <soap:body use="literal" /> </input> - <output> <soap:body use="literal" /> </output> </operation> </binding> - <service name="HelloService"> - <port binding="tns:HelloServiceWSBinding" name="HelloServiceWSPort"> <soap:address location="http://127.0.0.1:8080/wstest-ejb/HelloService" /> </port> </service> </definitions>
run the test and get
Exception in thread "main" javax.xml.ws.WebServiceException: Unable to load Provider: Failed to load javax.xml.ws.spi.Provider: com.sun.xml.ws.spi.ProviderImpl at javax.xml.ws.spi.Provider.provider(Provider.java:90) at javax.xml.ws.Service.<init>(Service.java:82) at org.wstest.webservices.HelloService.<init>(HelloService.java:40) at test.Test.main(Test.java:21) Caused by: java.lang.IllegalStateException: Failed to load javax.xml.ws.spi.Provider: com.sun.xml.ws.spi.ProviderImpl at javax.xml.ws.spi.ProviderLoader.loadProvider(ProviderLoader.java:96) at javax.xml.ws.spi.Provider.provider(Provider.java:82) ... 3 more Caused by: java.lang.ExceptionInInitializerError at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at java.lang.Class.newInstance0(Class.java:350) at java.lang.Class.newInstance(Class.java:303) at javax.xml.ws.spi.ProviderLoader.loadProvider(ProviderLoader.java:91) ... 4 more Caused by: javax.xml.ws.WebServiceException: Error creating JAXBContext for W3CEndpointReference. at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:188) at com.sun.xml.ws.spi.ProviderImpl.<clinit>(ProviderImpl.java:65) ... 11 more Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions Two classes have the same XML type name "address". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr at com.sun.xml.ws.developer.MemberSubmissionEndpointReference this problem is related to the following location: at javax.xml.ws.wsaddressing.W3CEndpointReference$Address at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address javax.xml.ws.wsaddressing.W3CEndpointReference.address at javax.xml.ws.wsaddressing.W3CEndpointReference Two classes have the same XML type name "elements". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties at com.sun.xml.ws.developer.MemberSubmissionEndpointReference this problem is related to the following location: at javax.xml.ws.wsaddressing.W3CEndpointReference$Elements at private javax.xml.ws.wsaddressing.W3CEndpointReference$Elements javax.xml.ws.wsaddressing.W3CEndpointReference.referenceParameters at javax.xml.ws.wsaddressing.W3CEndpointReference at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211) at javax.xml.bind.ContextFinder.find(ContextFinder.java:372) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522) at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:186) ... 12 more
please help i really want this to work so i can get back to my business problem - and not spend time trashing in frameworks.
doesnt work on 4.2.2 either