Java 无法访问Web服务

Java 无法访问Web服务,java,web-services,Java,Web Services,我试图通过我的java代码访问IIS服务器中托管的Web服务(C#),但读取响应超时。以下是我试图访问此Web服务的WSDL和java代码。我在java代码中提供的URL可通过浏览器访问 <?xml version="1.0" encoding="utf-8" ?> <wsdl:definitions name="EncryptService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xm

我试图通过我的java代码访问IIS服务器中托管的Web服务(C#),但读取响应超时。以下是我试图访问此Web服务的WSDL和java代码。我在java代码中提供的URL可通过浏览器访问

<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions name="EncryptService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
- <wsp:Policy wsu:Id="WSHttpBinding_IEncryptService_policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:ProtectionToken>
- <wsp:Policy>
- <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
- <wsp:Policy>
  <sp:RequireDerivedKeys />
- <sp:BootstrapPolicy>
- <wsp:Policy>
- <sp:SignedParts>
  <sp:Body />
  <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
  </sp:SignedParts>
- <sp:EncryptedParts>
  <sp:Body />
  </sp:EncryptedParts>
- <sp:SymmetricBinding>
- <wsp:Policy>
- <sp:ProtectionToken>
- <wsp:Policy>
- <sp:SpnegoContextToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
- <wsp:Policy>
  <sp:RequireDerivedKeys />
  </wsp:Policy>
  </sp:SpnegoContextToken>
  </wsp:Policy>
  </sp:ProtectionToken>
- <sp:AlgorithmSuite>
- <wsp:Policy>
  <sp:Basic256 />
  </wsp:Policy>
  </sp:AlgorithmSuite>
- <sp:Layout>
- <wsp:Policy>
  <sp:Strict />
  </wsp:Policy>
  </sp:Layout>
  <sp:IncludeTimestamp />
  <sp:EncryptSignature />
  <sp:OnlySignEntireHeadersAndBody />
  </wsp:Policy>
  </sp:SymmetricBinding>
- <sp:Wss11>
  <wsp:Policy />
  </sp:Wss11>
- <sp:Trust10>
- <wsp:Policy>
  <sp:MustSupportIssuedTokens />
  <sp:RequireClientEntropy />
  <sp:RequireServerEntropy />
  </wsp:Policy>
  </sp:Trust10>
  </wsp:Policy>
  </sp:BootstrapPolicy>
  </wsp:Policy>
  </sp:SecureConversationToken>
  </wsp:Policy>
  </sp:ProtectionToken>
- <sp:AlgorithmSuite>
- <wsp:Policy>
  <sp:Basic256 />
  </wsp:Policy>
  </sp:AlgorithmSuite>
- <sp:Layout>
- <wsp:Policy>
  <sp:Strict />
  </wsp:Policy>
  </sp:Layout>
  <sp:IncludeTimestamp />
  <sp:EncryptSignature />
  <sp:OnlySignEntireHeadersAndBody />
  </wsp:Policy>
  </sp:SymmetricBinding>
- <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
  <wsp:Policy />
  </sp:Wss11>
- <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
  <sp:MustSupportIssuedTokens />
  <sp:RequireClientEntropy />
  <sp:RequireServerEntropy />
  </wsp:Policy>
  </sp:Trust10>
  <wsaw:UsingAddressing />
  </wsp:All>
  </wsp:ExactlyOne>
  </wsp:Policy>
- <wsp:Policy wsu:Id="WSHttpBinding_IEncryptService_Decrypt_Input_policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
  <sp:Body />
  <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
  </sp:SignedParts>
- <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
  <sp:Body />
  </sp:EncryptedParts>
  </wsp:All>
  </wsp:ExactlyOne>
  </wsp:Policy>
- <wsp:Policy wsu:Id="WSHttpBinding_IEncryptService_Decrypt_output_policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
  <sp:Body />
  <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
  </sp:SignedParts>
- <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
  <sp:Body />
  </sp:EncryptedParts>
  </wsp:All>
  </wsp:ExactlyOne>
  </wsp:Policy>
- <wsp:Policy wsu:Id="WSHttpBinding_IEncryptService_Encrypt_Input_policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
  <sp:Body />
  <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
  </sp:SignedParts>
- <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
  <sp:Body />
  </sp:EncryptedParts>
  </wsp:All>
  </wsp:ExactlyOne>
  </wsp:Policy>
- <wsp:Policy wsu:Id="WSHttpBinding_IEncryptService_Encrypt_output_policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
  <sp:Body />
  <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
  <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
  </sp:SignedParts>
- <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
  <sp:Body />
  </sp:EncryptedParts>
  </wsp:All>
  </wsp:ExactlyOne>
  </wsp:Policy>
- <wsdl:types>
- <xsd:schema targetNamespace="http://tempuri.org/Imports">
  <xsd:import schemaLocation="http://pinenoil10034.pinelabs.com/EncryptService/service.svc?xsd=xsd0" namespace="http://tempuri.org/" />
  <xsd:import schemaLocation="http://pinenoil10034.pinelabs.com/EncryptService/service.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
  </xsd:schema>
  </wsdl:types>
- <wsdl:message name="IEncryptService_Decrypt_InputMessage">
  <wsdl:part name="parameters" element="tns:Decrypt" />
  </wsdl:message>
- <wsdl:message name="IEncryptService_Decrypt_OutputMessage">
  <wsdl:part name="parameters" element="tns:DecryptResponse" />
  </wsdl:message>
- <wsdl:message name="IEncryptService_Encrypt_InputMessage">
  <wsdl:part name="parameters" element="tns:Encrypt" />
  </wsdl:message>
- <wsdl:message name="IEncryptService_Encrypt_OutputMessage">
  <wsdl:part name="parameters" element="tns:EncryptResponse" />
  </wsdl:message>
- <wsdl:portType name="IEncryptService">
- <wsdl:operation name="Decrypt">
  <wsdl:input wsaw:Action="http://tempuri.org/IEncryptService/Decrypt" message="tns:IEncryptService_Decrypt_InputMessage" />
  <wsdl:output wsaw:Action="http://tempuri.org/IEncryptService/DecryptResponse" message="tns:IEncryptService_Decrypt_OutputMessage" />
  </wsdl:operation>
- <wsdl:operation name="Encrypt">
  <wsdl:input wsaw:Action="http://tempuri.org/IEncryptService/Encrypt" message="tns:IEncryptService_Encrypt_InputMessage" />
  <wsdl:output wsaw:Action="http://tempuri.org/IEncryptService/EncryptResponse" message="tns:IEncryptService_Encrypt_OutputMessage" />
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="WSHttpBinding_IEncryptService" type="tns:IEncryptService">
  <wsp:PolicyReference URI="#WSHttpBinding_IEncryptService_policy" />
  <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="Decrypt">
  <soap12:operation soapAction="http://tempuri.org/IEncryptService/Decrypt" style="document" />
- <wsdl:input>
  <wsp:PolicyReference URI="#WSHttpBinding_IEncryptService_Decrypt_Input_policy" />
  <soap12:body use="literal" />
  </wsdl:input>
- <wsdl:output>
  <wsp:PolicyReference URI="#WSHttpBinding_IEncryptService_Decrypt_output_policy" />
  <soap12:body use="literal" />
  </wsdl:output>
  </wsdl:operation>
- <wsdl:operation name="Encrypt">
  <soap12:operation soapAction="http://tempuri.org/IEncryptService/Encrypt" style="document" />
- <wsdl:input>
  <wsp:PolicyReference URI="#WSHttpBinding_IEncryptService_Encrypt_Input_policy" />
  <soap12:body use="literal" />
  </wsdl:input>
- <wsdl:output>
  <wsp:PolicyReference URI="#WSHttpBinding_IEncryptService_Encrypt_output_policy" />
  <soap12:body use="literal" />
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="EncryptService">
- <wsdl:port name="WSHttpBinding_IEncryptService" binding="tns:WSHttpBinding_IEncryptService">
  <soap12:address location="http://pinenoil10034.pinelabs.com/EncryptService/service.svc" />
- <wsa10:EndpointReference>
  <wsa10:Address>http://pinenoil10034.pinelabs.com/EncryptService/service.svc</wsa10:Address>
- <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
  <Upn>PINENOIL10034\ASPNET</Upn>
  </Identity>
  </wsa10:EndpointReference>
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>
回应是

Unable to sendViaPost to url[http://pinenoil10034.pinelabs.com/EncryptService/service.svc]
java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.io.BufferedInputStream.fill(Unknown Source)
        at java.io.BufferedInputStream.read(Unknown Source)

消费者邮箱和Web服务所在的邮箱之间是否有防火墙。

我打开了404-你确定子域正确吗?此URL不是公共的。我们可以通过局域网访问。你的浏览器使用HTTP代理吗?你能从服务器上下载这个URL吗?
Unable to sendViaPost to url[http://pinenoil10034.pinelabs.com/EncryptService/service.svc]
java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.io.BufferedInputStream.fill(Unknown Source)
        at java.io.BufferedInputStream.read(Unknown Source)