olá a todos…to enroscado num erro do webservice que estou precisando implementar para o meu servico
estou usando o jboss 4.2.1,ejb3 para aplicação
bom vo postar o código da minha classe de teste e o cliente
HelloUserWs.java
package com.br.prt.implementacao;
import javax.ejb.*;
import javax.jws.*;
@Stateless
@WebService(serviceName="Greeter",portName="GreeterPort")
public class HelloUserWS{
@WebMethod
public String hello()
{
System.out.println("hello()Ws");
return "Hello,World!!";
}
}
arquivo do cliente
package com.br.prt.util;
import java.net.URL;
import javax.xml.ws.Service;
import javax.xml.namespace.QName;
import com.br.prt.implementacao.HelloUserWS;
public class ClientWebService {
static String host="localhost";
static String portType="helloUserWS";
static String serviceName="Greeter";
static String serviceEndPointAddress="http://"+host+":8080/"+serviceName;
static String nameSpace="http://implementacao.prt.br.com";
public static void main(String[] args){
//http://127.0.0.1:8080/HelloUserWSService/HelloUserWS
//URL wsdlLocation=new URL(serviceEndPointAddress+"/"+portType+"?WSDL");
try{
URL wsdlLocation=new URL("http://localhost:8080/HelloUserWSService/HelloUserWS?WSDL");
QName serviceNameQ=new QName(nameSpace,serviceName);
Service service=Service.create(wsdlLocation,serviceNameQ);
HelloUserWS a= service.getPort(HelloUserWS.class);
System.out.println("1:"+a.hello());
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
agora o maldito erro…
Cannot create Service instance, service {http://implementacao.prt.br.com:GreeterPort}Greeter not found in the WSDL http://localhost:8080/HelloUserWSService/HelloUserWS?WSDL
at com.sun.xml.internal.ws.client.ServiceContextBuilder.build(ServiceContextBuilder.java:66)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:125)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:52)
at javax.xml.ws.Service.<init>(Service.java:57)
at javax.xml.ws.Service.create(Service.java:302)
at com.br.prt.util.ClientWebService.main(ClientWebService.java:21)
e por ultimo meu WSDL
<definitions name="Greeter" targetNamespace="http://implementacao.prt.br.com/">
−
<types>
−
<xs:schema targetNamespace="http://implementacao.prt.br.com/" version="1.0">
<xs:element name="hello" type="tns:hello"/>
<xs:element name="helloResponse" type="tns:helloResponse"/>
<xs:complexType name="hello"/>
−
<xs:complexType name="helloResponse">
−
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
−
<message name="HelloUserWS_helloResponse">
<part element="tns:helloResponse" name="helloResponse"/>
</message>
−
<message name="HelloUserWS_hello">
<part element="tns:hello" name="hello"/>
</message>
−
<portType name="HelloUserWS">
−
<operation name="hello" parameterOrder="hello">
<input message="tns:HelloUserWS_hello"/>
<output message="tns:HelloUserWS_helloResponse"/>
</operation>
</portType>
−
<binding name="HelloUserWSBinding" type="tns:HelloUserWS">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="hello">
<soap:operation soapAction=""/>
−
<input>
<soap:body use="literal"/>
</input>
−
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
−
<service name="Greeter">
−
<port binding="tns:HelloUserWSBinding" name="GreeterPort">
<soap:address location="http://127.0.0.1:8080/HelloUserWSService/HelloUserWS"/>
</port>
</service>
</definitions>
parece que está tudo ok no servidor …to dando furo em que?se puderem me ajudar …valeuz…abraços