2012-10-03 4 views
0

웹 서비스에 연결하려고 할 때 Glassfish 3.1.1에서 https로 작동하는 웹 서비스를 만들었습니다. 오류가 있습니다. 추적 : server.log에,에웹 서비스 클라이언트가 서버에 연결할 수 없습니다.

com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection timed out: connect 
at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:117) 
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:194) 
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122) 
at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95) 
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626) 
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585) 
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570) 
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467) 
at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308) 
at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:146) 
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) 
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) 
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129) 
at $Proxy32.getGUIDE(Unknown Source) 
at webserviceclient.WebServiceClient.getGUIDE(WebServiceClient.java:56) 
at webserviceclient.WebServiceClient.main(WebServiceClient.java:38) 
    Caused by: java.net.ConnectException: Connection timed out: connect 
at java.net.DualStackPlainSocketImpl.connect0(Native Method) 
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69) 
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) 
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) 
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) 
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157) 
at java.net.Socket.connect(Socket.java:579) 
at java.net.Socket.connect(Socket.java:528) 
at sun.net.NetworkClient.doConnect(NetworkClient.java:180) 
at sun.net.www.http.HttpClient.openServer(HttpClient.java:378) 
at sun.net.www.http.HttpClient$1.run(HttpClient.java:430) 
at sun.net.www.http.HttpClient$1.run(HttpClient.java:428) 
at java.security.AccessController.doPrivileged(Native Method) 
at sun.net.www.http.HttpClient.privilegedOpenServer(HttpClient.java:427) 
at sun.net.www.http.HttpClient.openServer(HttpClient.java:468) 
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:270) 
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:327) 
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) 
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:974) 
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) 
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1090) 
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250) 
at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:105) 

오류 내가 브라우저에서 시도 "테스터?"

[#|2012-10-03T15:38:24.250+0600|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=418;_ThreadName=Thread-2;|parsing WSDL... 

|#] 

[#|2012-10-03T15:38:24.359+0600|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=418;_ThreadName=Thread-2;|[ERROR] java.security.cert.CertificateException: No subject alternative names present 

Failed to read the WSDL document: https://192.168.40.2/WebService/NSI_NBRK?WSDL, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.|#] 

[#|2012-10-03T15:38:24.359+0600|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=418;_ThreadName=Thread-2;|[ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s): 

At least one WSDL with at least one service definition needs to be provided.|#] 

[#|2012-10-03T15:38:24.360+0600|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=418;_ThreadName=Thread-2;| Failed to parse the WSDL.|#] 

[#|2012-10-03T15:38:24.360+0600|INFO|glassfish3.1.1|javax.enterprise.webservices.org.glassfish.webservices.monitoring|_ThreadID=418;_ThreadName=Thread-2;|Invoking wsimport with https://192.168.40.2/WebService/NSI_NBRK?WSDL|#] 
[#|2012-10-03T15:38:24.361+0600|SEVERE|glassfish3.1.1|javax.enterprise.webservices.org.glassfish.webservices.monitoring|_ThreadID=418;_ThreadName=Thread-2;|wsimport failed|#] 

WSDL :

<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.1.1-b09 (branches/2.1-6834; 2011-07-16T17:14:48+0000) JAXWS-RI/2.2.5-promoted-b04 JAXWS/2.2. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.1.1-b09 (branches/2.1-6834; 2011-07-16T17:14:48+0000) JAXWS-RI/2.2.5-promoted-b04 JAXWS/2.2. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://service/" name="NSI_NBRK"> 
<types> 
<xsd:schema> 
<xsd:import namespace="http://service/" schemaLocation="./NSI_NBRK.xsd"/> 
</xsd:schema> 
</types> 
<message name="GET_GUIDE"> 
<part name="parameters" element="tns:GET_GUIDE"/> 
</message> 
<message name="GET_GUIDEResponse"> 
<part name="parameters" element="tns:GET_GUIDEResponse"/> 
</message> 
<portType name="Service"> 
<operation name="GET_GUIDE"> 
<input wsam:Action="http://service/Service/GET_GUIDERequest" message="tns:GET_GUIDE"/> 
<output wsam:Action="http://service/Service/GET_GUIDEResponse" message="tns:GET_GUIDEResponse"/> 
</operation> 
</portType> 
<binding name="ServicePortBinding" type="tns:Service"> 
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> 
<operation name="GET_GUIDE"> 
<soap:operation soapAction=""/> 
<input> 
<soap:body use="literal"/> 
</input> 
<output> 
<soap:body use="literal"/> 
</output> 
</operation> 
</binding> 
<service name="NSI_NBRK"> 
<port name="ServicePort" binding="tns:ServicePortBinding"> 
<soap:address location="https://192.168.40.2/WebService/NSI_NBRK"/> 
</port> 
</service> 
</definitions> 

및 XSD 스키마 :

<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.1.1-b09 (branches/2.1-6834; 2011-07-16T17:14:48+0000) JAXWS-RI/2.2.5-promoted-b04 JAXWS/2.2. --><xs:schema xmlns:tns="http://service/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://service/"> 

<xs:element name="GET_GUIDE" type="tns:GET_GUIDE"/> 

<xs:element name="GET_GUIDEResponse" type="tns:GET_GUIDEResponse"/> 

<xs:complexType name="GET_GUIDE"> 
<xs:sequence> 
<xs:element name="arg0" type="tns:serviceRequest" minOccurs="0"/> 
</xs:sequence> 
</xs:complexType> 

<xs:complexType name="serviceRequest"> 
<xs:sequence> 
<xs:element name="beginDate" type="xs:dateTime" minOccurs="0"/> 
<xs:element name="endDate" type="xs:dateTime" minOccurs="0"/> 
<xs:element name="guideCode" type="tns:guideCode" minOccurs="0"/> 
<xs:element name="type" type="tns:guideType" minOccurs="0"/> 
</xs:sequence> 
</xs:complexType> 

<xs:complexType name="GET_GUIDEResponse"> 
<xs:sequence> 
<xs:element name="return" type="tns:serviceResponse" minOccurs="0"/> 
</xs:sequence> 
</xs:complexType> 

<xs:complexType name="serviceResponse"> 
<xs:sequence> 
<xs:element name="errCode" type="xs:int"/> 
<xs:element name="errMsg" type="xs:string" minOccurs="0"/> 
<xs:element name="result" type="xs:string" minOccurs="0"/> 
</xs:sequence> 
</xs:complexType> 

<xs:simpleType name="guideCode"> 
<xs:restriction base="xs:string"> 
<xs:enumeration value="NSI_NBRK_BANK"/> 
<xs:enumeration value="NSI_NBRK_CRCY_COURSE"/> 
<xs:enumeration value="NSI_NBRK_KNP"/> 
</xs:restriction> 
</xs:simpleType> 

<xs:simpleType name="guideType"> 
<xs:restriction base="xs:string"> 
<xs:enumeration value="FULL"/> 
<xs:enumeration value="CHAD"/> 
</xs:restriction> 
</xs:simpleType> 
</xs:schema> 

그리고 web.xml :

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> 
    <session-config> 
     <session-timeout>300</session-timeout> 
    </session-config> 
    <security-constraint> 
     <display-name>Constraint</display-name> 
     <web-resource-collection> 
      <web-resource-name>service</web-resource-name> 
      <description>service</description> 
      <url-pattern>/*</url-pattern> 
     </web-resource-collection> 
     <user-data-constraint> 
      <description>service</description> 
      <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
     </user-data-constraint> 
    </security-constraint> 
</web-app> 
+0

ConnectException이 일반적으로 발생됩니다. 서비스가 실행되고 있습니까? 또한 전체 WSDL 및 XSD를 게시하고 메타 태그 만 게시하면 주석이 특별히 도움이되지 않습니다. – joergl

+0

브라우저와 연결을 확인하면 wsdl 및 스키마가 표시되지만 "? Tester"를 시도하면 "다음 WSDL https://192.168.40.2/WebService/NSI_NBRK?WSDL에 대한 아티팩트 생성 중 오류가 발생합니다. 응용 프로그램이 보안을 위해 구성되지 않은 경우 https를 호출 할 수있는 원인은 " – test1604

+0

입니다. https를 사용하도록 서비스를 구성한 방법은 무엇입니까? WSDL에서 WS-Security 및 WS-Policy 네임 스페이스 정의를 볼 수 있지만 실제 정책은 없습니다. – joergl

답변

0

연결 문제가있는 것으로 보입니다. 웹 브라우저에서 wsdl을보고 연결을 확인하거나 192.168.40.2로 핀을 지정하십시오.

예외는 무엇입니까?

도움이되는지 확인 하시겠습니까? 당신은 아무도 듣고되지 않은 주소에 연결하려고 할 때

http://www.mkyong.com/webservices/jax-ws/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-requested-target/

+0

ping을 192.168.40.2로 변경하면 OK입니다. 브라우저에서 wsdl을 얻을 수 있습니다. – test1604

+0

도움이되는지 확인하려면이 URL을 확인하십시오. http://www.mkyong.com/webservices/jax-ws/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-requested-target/ – Suranga

+0

그는 글래스 피쉬를 사용하고 있습니다. 나는 바람둥이 튜토리얼이 도움이 될지 의심 스럽다. – joergl

관련 문제