java - Exception in thread "main" javax.xml.ws.WebServiceException: Undefined port type: {http://intTest.store.com/}TestInterface -
hi getting following exception in java web service example trying do.
exception in thread "main" javax.xml.ws.webserviceexception: undefined port type: {http://inttest.store.com/}testinterface @ com.sun.xml.internal.ws.client.wsservicedelegate.getport(wsservicedelegate.java:329) @ com.sun.xml.internal.ws.client.wsservicedelegate.getport(wsservicedelegate.java:335) @ javax.xml.ws.service.getport(service.java:161) @ com.client.client.main(client.java:21)
my files below, cant figure out doing wrong here. here interface file. filename: testinterface.java
/** * */ package com.store.inttest; import java.sql.sqlexception; import javax.jws.webmethod; import javax.jws.webservice; import javax.jws.soap.soapbinding; import javax.jws.soap.soapbinding.style; @webservice @soapbinding(style = style.document) public interface testinterface { @webmethod public void display() throws sqlexception; }
here interface implementation web service
filename: homeimpl.java
package com.store.home; import helper.homedisplay; import java.util.linkedlist; import javax.jws.webmethod; import javax.jws.webservice; import com.jdbc.homedao; import com.store.inttest.testinterface; //(name = "endpointinterface", targetnamespace= "com.store.home.homeimpl", servicename = "homeimplservice") @webservice public class homeimpl implements testinterface{ linkedlist<homedisplay> list = new linkedlist<homedisplay>(); //public public homeimpl() { // super(); // // todo auto-generated constructor stub //} @override @webmethod public void display() { // todo auto-generated method stub homedao obj= new homedao(); list = obj.finderdisplay(); } }
here publisher file used publish service. filename: publisher.java
package com.endpoint.publisher; import javax.xml.ws.endpoint; import com.store.home.homeimpl; public class publisher { public static void main(string[] args) { // todo auto-generated method stub endpoint.publish("http://localhost:9997/ws/home", new homeimpl()); system.out.println("succesfully deployed webservices"); } }
here client file trying call service from. filename: client.java
package com.client; import java.net.malformedurlexception; import java.net.url; import java.sql.sqlexception; import javax.xml.namespace.qname; import javax.xml.ws.service; import com.store.inttest.testinterface; public class client { public static void main(string[] args) { // todo auto-generated method stub try { url url = new url("http://localhost:9997/ws/home?wsdl"); qname qname = new qname("http://home.store.com/", "homeimplservice"); service service = service.create(url, qname); testinterface h = service.getport(testinterface.class); try { h.display(); } catch (sqlexception e) { //todo auto-generated catch block e.printstacktrace(); } } catch (malformedurlexception e) { // todo auto-generated catch block e.printstacktrace(); } } }
here wsdl service created publishing service.
<!-- published jax-ws ri @ http://jax-ws.dev.java.net. ri's version jax-ws ri 2.1.6 in jdk 6. --> <!-- generated jax-ws ri @ http://jax-ws.dev.java.net. ri's version jax-ws ri 2.1.6 in jdk 6. --> <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://home.store.com/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetnamespace="http://home.store.com/" name="homeimplservice"> <types> <xsd:schema> <xsd:import namespace="http://home.store.com/" schemalocation="http://localhost:9997/ws/home?xsd=1"/> </xsd:schema> </types> <message name="display"> <part name="parameters" element="tns:display"/> </message> <message name="displayresponse"> <part name="parameters" element="tns:displayresponse"/> </message> <porttype name="homeimpl"> <operation name="display"> <input message="tns:display"/> <output message="tns:displayresponse"/> </operation> </porttype> <binding name="homeimplportbinding" type="tns:homeimpl"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <operation name="display"> <soap:operation soapaction=""/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="homeimplservice"> <port name="homeimplport" binding="tns:homeimplportbinding"> <soap:address location="http://localhost:9997/ws/home"/> </port> </service> </definitions>
Comments
Post a Comment