mardi 29 avril 2014

Causée par : java.net.UnknownHostException : ASHISH_PC lors de l'appel de service web - Stack Overflow


Hi all as I am trying to invoke web service throw web service client. created through


http://118.102.123.190:8080/Myproject/TestConfigWS?wsdl

URL but I am getting Caused by: java.net.UnknownHostException: ASHISH_PC error.


after investigating bit and reading this article I found that I have to make a host entry to solve this problem.


118.102.123.190 ASHISH_PC

after making entry It solve the error,but in my case it's not a best way to make an entry of each and every host in my hosts file so I want an alternative way to solve this problem can some one help me on this ?


Web Service Implementer Class


@javax.jws.WebService(
serviceName = "TestConfigWSService",
portName = "TestConfigWSPort",
targetNamespace = "http://mypackage.com/",
wsdlLocation = "http://118.102.123.190:8080/Myproject/TestConfigWS?wsdl",
endpointInterface = "com.mypackage.TestConfigWS")

public class TestConfigWSImpl implements TestConfigWS {

/* (non-Javadoc)
* @see com.mypackage.TestConfigWS#test(java.lang.String arg0 )*
*/
public boolean test(java.lang.String arg0) {
LOG.info("Executing operation test");
System.out.println(arg0);
try {
boolean _return = false;
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}

}

TestConfigWSService.wsdl


<wsdl:service name="TestConfigWSService">
<wsdl:port binding="tns:TestConfigWSServiceSoapBinding" name="TestConfigWSPort">
<soap:address location="http://ASHISH_PC:8080/Myproject/TestConfigWS"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

In short how can I replace ASHISH_PC with my IP (i.e. 118.102.123.190) in my


<soap:address location="http://ASHISH_PC:8080/Myproject/TestConfigWS"/>

attribute Thanks...


Web- Server


I am using JBOSS AS 7 to deploy my web service.


jboss-as-7.1.1.Final




Finally got the solution I have added jbossws.undefined.host value in <wsdl-host> attribute in standalone.xml file under JBOSS_HOME/standalone/configuration location as follows


<subsystem xmlns="urn:jboss:domain:webservices:1.1">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>jbossws.undefined.host</wsdl-host>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
</subsystem>

this solves my problem It replace ASHISH_PC with my IP in my <soap:address> attribute.



Hi all as I am trying to invoke web service throw web service client. created through


http://118.102.123.190:8080/Myproject/TestConfigWS?wsdl

URL but I am getting Caused by: java.net.UnknownHostException: ASHISH_PC error.


after investigating bit and reading this article I found that I have to make a host entry to solve this problem.


118.102.123.190 ASHISH_PC

after making entry It solve the error,but in my case it's not a best way to make an entry of each and every host in my hosts file so I want an alternative way to solve this problem can some one help me on this ?


Web Service Implementer Class


@javax.jws.WebService(
serviceName = "TestConfigWSService",
portName = "TestConfigWSPort",
targetNamespace = "http://mypackage.com/",
wsdlLocation = "http://118.102.123.190:8080/Myproject/TestConfigWS?wsdl",
endpointInterface = "com.mypackage.TestConfigWS")

public class TestConfigWSImpl implements TestConfigWS {

/* (non-Javadoc)
* @see com.mypackage.TestConfigWS#test(java.lang.String arg0 )*
*/
public boolean test(java.lang.String arg0) {
LOG.info("Executing operation test");
System.out.println(arg0);
try {
boolean _return = false;
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}

}

TestConfigWSService.wsdl


<wsdl:service name="TestConfigWSService">
<wsdl:port binding="tns:TestConfigWSServiceSoapBinding" name="TestConfigWSPort">
<soap:address location="http://ASHISH_PC:8080/Myproject/TestConfigWS"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

In short how can I replace ASHISH_PC with my IP (i.e. 118.102.123.190) in my


<soap:address location="http://ASHISH_PC:8080/Myproject/TestConfigWS"/>

attribute Thanks...


Web- Server


I am using JBOSS AS 7 to deploy my web service.


jboss-as-7.1.1.Final



Finally got the solution I have added jbossws.undefined.host value in <wsdl-host> attribute in standalone.xml file under JBOSS_HOME/standalone/configuration location as follows


<subsystem xmlns="urn:jboss:domain:webservices:1.1">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>jbossws.undefined.host</wsdl-host>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
</subsystem>

this solves my problem It replace ASHISH_PC with my IP in my <soap:address> attribute.


0 commentaires:

Enregistrer un commentaire