java - soap web service response very slow -
i generated soap web service
and when try consume service have problem
it takes many time response ( more 4 minutes )
i try test code :
import javax.jws.webmethod; import javax.jws.webservice; import javax.jws.soap.soapbinding; import javax.jws.soap.soapbinding.style; @webservice @soapbinding(style = style.rpc) public interface balance { @webmethod string getvalue(); }
this java class
import javax.jws.webservice; @webservice(endpointinterface = "com.dq.test.web.manager.impl.balance") public class balanceimp implements balance{ @override public string getvalue() { // todo auto-generated method stub return "test"; } }
to publish web service used code :
endpoint.publish("http://192.168.1.13:8080/ws/testsoap", new balanceimp());
this code of wsdl :
<!-- 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://impl.manager.web.test.dq.com/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetnamespace="http://impl.manager.web.test.dq.com/" name="balanceimpservice"> <types/> <message name="getvalue"/> <message name="getvalueresponse"> <part name="return" type="xsd:string"/> </message> <porttype name="balance"> <operation name="getvalue"> <input message="tns:getvalue"/> <output message="tns:getvalueresponse"/> </operation> </porttype> <binding name="balanceimpportbinding" type="tns:balance"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/> <operation name="getvalue"> <soap:operation soapaction=""/> <input> <soap:body use="literal" namespace="http://impl.manager.web.test.dq.com/"/> </input> <output> <soap:body use="literal" namespace="http://impl.manager.web.test.dq.com/"/> </output> </operation> </binding> <service name="balanceimpservice"> <port name="balanceimpport" binding="tns:balanceimpportbinding"> <soap:address location="http://192.168.1.13:8080/ws/testsoap"/> </port> </service> </definitions>
i used eclipse in order generate , test client :
this test code :
balanceimpservicelocator loc = new balanceimpservicelocator(); balanceimpportbindingstub bindingstub = new balanceimpportbindingstub(new url(loc.getbalanceimpportaddress()),loc); system.out.println(" -- start test ----"); string string = bindingstub.getvalue()
i try wsdl example published in net ( http://www.webservicex.net/weatherforecast.asmx?wsdl ).
i generate client using eclipse .
the response fast example .
this source code example :
wsdl:definitions xmlns:tm="http://microsoft.com/wsdl/mime/textmatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.webservicex.net" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/xmlschema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetnamespace="http://www.webservicex.net"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 1 week weather forecast valid zip code or place name in usa </wsdl:documentation> <wsdl:types> <s:schema elementformdefault="qualified" targetnamespace="http://www.webservicex.net"> <s:element name="getweatherbyzipcode"> <s:complextype> <s:sequence> <s:element minoccurs="0" maxoccurs="1" name="zipcode" type="s:string"/> </s:sequence> </s:complextype> </s:element> <s:element name="getweatherbyzipcoderesponse"> <s:complextype> <s:sequence> <s:element minoccurs="1" maxoccurs="1" name="getweatherbyzipcoderesult" type="tns:weatherforecasts"/> </s:sequence> </s:complextype> </s:element> <s:complextype name="weatherforecasts"> <s:sequence> <s:element minoccurs="1" maxoccurs="1" name="latitude" type="s:float"/> <s:element minoccurs="1" maxoccurs="1" name="longitude" type="s:float"/> <s:element minoccurs="1" maxoccurs="1" name="allocationfactor" type="s:float"/> <s:element minoccurs="0" maxoccurs="1" name="fipscode" type="s:string"/> <s:element minoccurs="0" maxoccurs="1" name="placename" type="s:string"/> <s:element minoccurs="0" maxoccurs="1" name="statecode" type="s:string"/> <s:element minoccurs="0" maxoccurs="1" name="status" type="s:string"/> <s:element minoccurs="0" maxoccurs="1" name="details" type="tns:arrayofweatherdata"/> </s:sequence> </s:complextype> <s:complextype name="arrayofweatherdata"> <s:sequence> <s:element minoccurs="0" maxoccurs="unbounded" name="weatherdata" type="tns:weatherdata"/> </s:sequence> </s:complextype> <s:complextype name="weatherdata"> <s:sequence> <s:element minoccurs="0" maxoccurs="1" name="day" type="s:string"/> <s:element minoccurs="0" maxoccurs="1" name="weatherimage" type="s:string"/> <s:element minoccurs="0" maxoccurs="1" name="maxtemperaturef" type="s:string"/> <s:element minoccurs="0" maxoccurs="1" name="mintemperaturef" type="s:string"/> <s:element minoccurs="0" maxoccurs="1" name="maxtemperaturec" type="s:string"/> <s:element minoccurs="0" maxoccurs="1" name="mintemperaturec" type="s:string"/> </s:sequence> </s:complextype> <s:element name="getweatherbyplacename"> <s:complextype> <s:sequence> <s:element minoccurs="0" maxoccurs="1" name="placename" type="s:string"/> </s:sequence> </s:complextype> </s:element> <s:element name="getweatherbyplacenameresponse"> <s:complextype> <s:sequence> <s:element minoccurs="1" maxoccurs="1" name="getweatherbyplacenameresult" type="tns:weatherforecasts"/> </s:sequence> </s:complextype> </s:element> <s:element name="weatherforecasts" type="tns:weatherforecasts"/> </s:schema> </wsdl:types> <wsdl:message name="getweatherbyzipcodesoapin"> <wsdl:part name="parameters" element="tns:getweatherbyzipcode"/> </wsdl:message> <wsdl:message name="getweatherbyzipcodesoapout"> <wsdl:part name="parameters" element="tns:getweatherbyzipcoderesponse"/> </wsdl:message> <wsdl:message name="getweatherbyplacenamesoapin"> <wsdl:part name="parameters" element="tns:getweatherbyplacename"/> </wsdl:message> <wsdl:message name="getweatherbyplacenamesoapout"> <wsdl:part name="parameters" element="tns:getweatherbyplacenameresponse"/> </wsdl:message> <wsdl:message name="getweatherbyzipcodehttpgetin"> <wsdl:part name="zipcode" type="s:string"/> </wsdl:message> <wsdl:message name="getweatherbyzipcodehttpgetout"> <wsdl:part name="body" element="tns:weatherforecasts"/> </wsdl:message> <wsdl:message name="getweatherbyplacenamehttpgetin"> <wsdl:part name="placename" type="s:string"/> </wsdl:message> <wsdl:message name="getweatherbyplacenamehttpgetout"> <wsdl:part name="body" element="tns:weatherforecasts"/> </wsdl:message> <wsdl:message name="getweatherbyzipcodehttppostin"> <wsdl:part name="zipcode" type="s:string"/> </wsdl:message> <wsdl:message name="getweatherbyzipcodehttppostout"> <wsdl:part name="body" element="tns:weatherforecasts"/> </wsdl:message> <wsdl:message name="getweatherbyplacenamehttppostin"> <wsdl:part name="placename" type="s:string"/> </wsdl:message> <wsdl:message name="getweatherbyplacenamehttppostout"> <wsdl:part name="body" element="tns:weatherforecasts"/> </wsdl:message> <wsdl:porttype name="weatherforecastsoap"> <wsdl:operation name="getweatherbyzipcode"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 1 week weather forecast valid zip code(usa) </wsdl:documentation> <wsdl:input message="tns:getweatherbyzipcodesoapin"/> <wsdl:output message="tns:getweatherbyzipcodesoapout"/> </wsdl:operation> <wsdl:operation name="getweatherbyplacename"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 1 week weather forecast place name(usa) </wsdl:documentation> <wsdl:input message="tns:getweatherbyplacenamesoapin"/> <wsdl:output message="tns:getweatherbyplacenamesoapout"/> </wsdl:operation> </wsdl:porttype> <wsdl:porttype name="weatherforecasthttpget"> <wsdl:operation name="getweatherbyzipcode"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 1 week weather forecast valid zip code(usa) </wsdl:documentation> <wsdl:input message="tns:getweatherbyzipcodehttpgetin"/> <wsdl:output message="tns:getweatherbyzipcodehttpgetout"/> </wsdl:operation> <wsdl:operation name="getweatherbyplacename"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 1 week weather forecast place name(usa) </wsdl:documentation> <wsdl:input message="tns:getweatherbyplacenamehttpgetin"/> <wsdl:output message="tns:getweatherbyplacenamehttpgetout"/> </wsdl:operation> </wsdl:porttype> <wsdl:porttype name="weatherforecasthttppost"> <wsdl:operation name="getweatherbyzipcode"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 1 week weather forecast valid zip code(usa) </wsdl:documentation> <wsdl:input message="tns:getweatherbyzipcodehttppostin"/> <wsdl:output message="tns:getweatherbyzipcodehttppostout"/> </wsdl:operation> <wsdl:operation name="getweatherbyplacename"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 1 week weather forecast place name(usa) </wsdl:documentation> <wsdl:input message="tns:getweatherbyplacenamehttppostin"/> <wsdl:output message="tns:getweatherbyplacenamehttppostout"/> </wsdl:operation> </wsdl:porttype> <wsdl:binding name="weatherforecastsoap" type="tns:weatherforecastsoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="getweatherbyzipcode"> <soap:operation soapaction="http://www.webservicex.net/getweatherbyzipcode" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="getweatherbyplacename"> <soap:operation soapaction="http://www.webservicex.net/getweatherbyplacename" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="weatherforecastsoap12" type="tns:weatherforecastsoap"> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="getweatherbyzipcode"> <soap12:operation soapaction="http://www.webservicex.net/getweatherbyzipcode" style="document"/> <wsdl:input> <soap12:body use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="getweatherbyplacename"> <soap12:operation soapaction="http://www.webservicex.net/getweatherbyplacename" style="document"/> <wsdl:input> <soap12:body use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="weatherforecasthttpget" type="tns:weatherforecasthttpget"> <http:binding verb="get"/> <wsdl:operation name="getweatherbyzipcode"> <http:operation location="/getweatherbyzipcode"/> <wsdl:input> <http:urlencoded/> </wsdl:input> <wsdl:output> <mime:mimexml part="body"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="getweatherbyplacename"> <http:operation location="/getweatherbyplacename"/> <wsdl:input> <http:urlencoded/> </wsdl:input> <wsdl:output> <mime:mimexml part="body"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="weatherforecasthttppost" type="tns:weatherforecasthttppost"> <http:binding verb="post"/> <wsdl:operation name="getweatherbyzipcode"> <http:operation location="/getweatherbyzipcode"/> <wsdl:input> <mime:content type="application/x-www-form-urlencoded"/> </wsdl:input> <wsdl:output> <mime:mimexml part="body"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="getweatherbyplacename"> <http:operation location="/getweatherbyplacename"/> <wsdl:input> <mime:content type="application/x-www-form-urlencoded"/> </wsdl:input> <wsdl:output> <mime:mimexml part="body"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="weatherforecast"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 1 week weather forecast valid zip code or place name in usa </wsdl:documentation> <wsdl:port name="weatherforecastsoap" binding="tns:weatherforecastsoap"> <soap:address location="http://www.webservicex.net/weatherforecast.asmx"/> </wsdl:port> <wsdl:port name="weatherforecastsoap12" binding="tns:weatherforecastsoap12"> <soap12:address location="http://www.webservicex.net/weatherforecast.asmx"/> </wsdl:port> <wsdl:port name="weatherforecasthttpget" binding="tns:weatherforecasthttpget"> <http:address location="http://www.webservicex.net/weatherforecast.asmx"/> </wsdl:port> <wsdl:port name="weatherforecasthttppost" binding="tns:weatherforecasthttppost"> <http:address location="http://www.webservicex.net/weatherforecast.asmx"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
i did not determine difference between 2 example , why in first example response slow
the problem publishing method
endpoint.publish("http://192.168.1.13:8080/ws/testsoap", new balanceimp());
try use wizard of creating , publishing web service using eclipse in source application (the publisher). wizard change web.xml adding
<servlet> <display-name>apache-axis servlet</display-name> <servlet-name>axisservlet</servlet-name> <servlet-class>org.apache.axis.transport.http.axisservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>axisservlet</servlet-name> <url-pattern>/servlet/axisservlet</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>axisservlet</servlet-name> <url-pattern>*.jws</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>axisservlet</servlet-name> <url-pattern>/services/*</url-pattern> </servlet-mapping> <servlet> <display-name>axis admin servlet</display-name> <servlet-name>adminservlet</servlet-name> <servlet-class>org.apache.axis.transport.http.adminservlet</servlet-class> <load-on-startup>100</load-on-startup> </servlet> <servlet-mapping> <servlet-name>adminservlet</servlet-name> <url-pattern>/servlet/adminservlet</url-pattern> </servlet-mapping>
and add under web-inf/ files deploy.wsdd ,undeploy.wsdd , of course service.wsdl in find your
<wsdlsoap:address location=".."/>
also file server-config.wsdd added when deployed.
put address , service .
your response instant.
Comments
Post a Comment