集群环境中的Web服务

时间:2011-11-03 08:47:00

标签: java web-services jboss wsdl webservice-client

我有一个在两个集群上运行的Web服务,负载均衡器决定转发请求的位置。由于防火墙规则,客户端计算机只能看到负载均衡器,并且两个应用程序服务器无法看到负载均衡器。我在集群上有以下wsdl文件:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.1-hudson-10-. -->
<definitions targetNamespace="http://contract.company-europe.com/" name="contractServiceService"
             xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy"
             xmlns:tns="http://contract.company-europe.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
             xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsp:Policy wsu:Id="contractAgreementServicePortBinding_getcontractAgreement_WSAT_Policy"
                xmlns:wsat="http://schemas.xmlsoap.org/ws/2004/10/wsat">
        <wsat:ATAlwaysCapability/>
        <wsat:ATAssertion wsp:Optional="true" ns2:Optional="true"
                          xmlns:ns2="http://schemas.xmlsoap.org/ws/2002/12/policy"/>
    </wsp:Policy>
    <types>
        <xsd:schema>
            <xsd:import namespace="http://contract.company-europe.com/"
                        schemaLocation="schemaLocation="http://loadbalancer/merlin/contractAgreementService?wsdl&resource=contractAgreementServiceService_schema.xsd"/>
        </xsd:schema>
    </types>
    <message name="getcontractAgreement">
        <part name="parameters" element="tns:getcontractAgreement"/>
    </message>
    <message name="getcontractAgreementResponse">
        <part name="parameters" element="tns:getcontractAgreementResponse"/>
    </message>
    <message name="IOException">
        <part name="fault" element="tns:IOException"/>
    </message>

    <message name="MerlinBaseException">
        <part name="fault" element="tns:MerlinBaseException"/>
    </message>

    <portType name="contractAgreementService">
        <operation name="getcontractAgreement">
            <input wsam:Action="http://contract.company-europe.com/contractAgreementService/getcontractAgreementRequest"
                   message="tns:getcontractAgreement"/>
            <output wsam:Action="http://contract.company-europe.com/contractAgreementService/getcontractAgreementResponse"
                    message="tns:getcontractAgreementResponse"/>
            <fault message="tns:IOException" name="IOException"
                   wsam:Action="http://contract.company-europe.com/contractAgreementService/getcontractAgreement/Fault/IOException"/>
            <fault message="tns:MerlinBaseException" name="MerlinBaseException"
                   wsam:Action="http://contract.company-europe.com/contractAgreementService/getcontractAgreement/Fault/MerlinBaseException"/>
        </operation>
    </portType>

    <binding name="contractAgreementServicePortBinding" type="tns:contractAgreementService">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <operation name="getcontractAgreement">
            <wsp:PolicyReference URI="#contractAgreementServicePortBinding_getcontractAgreement_WSAT_Policy"/>
            <soap:operation soapAction=""/>
            <input>
                <wsp:PolicyReference URI="#contractAgreementServicePortBinding_getcontractAgreement_WSAT_Policy"/>
                <soap:body use="literal"/>
            </input>
            <output>
                <wsp:PolicyReference URI="#contractAgreementServicePortBinding_getcontractAgreement_WSAT_Policy"/>
                <soap:body use="literal"/>
            </output>
            <fault name="IOException">
                <soap:fault name="IOException" use="literal"/>
            </fault>
            <fault name="MerlinBaseException">
                <soap:fault name="MerlinBaseException" use="literal"/>
            </fault>
        </operation>
    </binding>
    <service name="contractAgreementServiceService">
        <port name="contractAgreementServicePort" binding="tns:contractAgreementServicePortBinding">
            <soap:address location="http://loadbalancer/merlin/contractAgreementService"/>
        </port>
    </service>
</definitions>

soap地址和xsd是否指向负载均衡器或者它们是否应使用本地cluster1 / cluster2地址是否正确?

UPDATE1

不幸的是我收到以下错误消息。这仅在集群环境中发生:

2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:100) -  - REQUEST URI       =/merlin/contractAgreementService
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:101) -  -           authType=null
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:102) -  -  characterEncoding=utf-8
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:103) -  -      contentLength=273
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:104) -  -        contentType=text/xml; charset=utf-8
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:105) -  -        contextPath=/merlin
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:118) -  -             header=content-type=text/xml; charset=utf-8
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:118) -  -             header=soapaction="http://rental.company-europe.com/contractAgreementService/getContractAgreementRequest"
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:118) -  -             header=host=loadbalancer
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:118) -  -             header=content-length=273
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:118) -  -             header=expect=100-continue
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:118) -  -             header=connection=Keep-Alive
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:121) -  -             locale=en_GB
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:122) -  -             method=POST
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:134) -  -          parameter=wsdl=
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:136) -  -           pathInfo=null
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:137) -  -           protocol=HTTP/1.1
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:138) -  -        queryString=wsdl
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:139) -  -         remoteAddr=10.101.98.79
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:140) -  -         remoteHost=10.101.98.79
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:141) -  -         remoteUser=null
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:142) -  - requestedSessionId=null
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:143) -  -             scheme=http
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:144) -  -         serverName=loadbalancer
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:145) -  -         serverPort=80
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:146) -  -        servletPath=/contractAgreementService
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:147) -  -           isSecure=false
[2011-11-03 09:43:21,937] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:148) -  - ---------------------------------------------------------------
[2011-11-03 09:43:21,937] DEBUG (org.jboss.ws.core.soap.MessageContextAssociation:46) -  - pushMessageContext: org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS@77c1ca7 (Thread http-FXPEARLAP2%2F10.101.117.5-58080-2)
[2011-11-03 09:43:21,937] DEBUG (org.jboss.ws.core.soap.MessageFactoryImpl:215) -  - createMessage: [contentType=text/xml; charset=utf-8]
[2011-11-03 09:43:21,937] DEBUG (org.jboss.ws.metadata.umdm.EndpointMetaData:732) -  - Configure SOAPBinding
[2011-11-03 09:43:21,937] ERROR (org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS:149) -  - SOAP request exception
java.io.IOException
    at org.apache.coyote.http11.InternalAprInputBuffer.fill(InternalAprInputBuffer.java:763)
    at org.apache.coyote.http11.InternalAprInputBuffer$SocketInputBuffer.doRead(InternalAprInputBuffer.java:792)
    at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:116)
    at org.apache.coyote.http11.InternalAprInputBuffer.doRead(InternalAprInputBuffer.java:703)
    at org.apache.coyote.Request.doRead(Request.java:428)
    at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:297)
    at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:405)
    at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:312)
    at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:162)
    at org.jboss.wsf.common.IOUtils.copyStream(IOUtils.java:69)
    at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:224)
    at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:195)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:447)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:284)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
    at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve.java:151)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:856)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:566)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
    at java.lang.Thread.run(Thread.java:662)
[2011-11-03 09:43:21,953] DEBUG (org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS:269) -  - Cannot obtain fault meta data for: class java.io.IOException
[2011-11-03 09:43:21,953] DEBUG (org.jboss.ws.core.soap.MessageContextAssociation:75) -  - popMessageContext: org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS@77c1ca7 (Thread http-FXPEARLAP2%2F10.101.117.5-58080-2)
[2011-11-03 09:43:21,953] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:154) -  - ---------------------------------------------------------------
[2011-11-03 09:43:21,953] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:155) -  -           authType=null
[2011-11-03 09:43:21,953] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:156) -  -      contentLength=-1
[2011-11-03 09:43:21,953] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:157) -  -        contentType=text/xml;charset=UTF-8
[2011-11-03 09:43:21,953] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:168) -  -             header=X-Powered-By=Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)/JBossWeb-2.0
[2011-11-03 09:43:21,953] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:168) -  -             header=Content-Type=text/xml;charset=UTF-8
[2011-11-03 09:43:21,953] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:168) -  -             header=Transfer-Encoding=chunked
[2011-11-03 09:43:21,953] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:168) -  -             header=Date=Thu, 03 Nov 2011 09:43:21 GMT
[2011-11-03 09:43:21,968] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:168) -  -             header=Connection=close
[2011-11-03 09:43:21,968] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:170) -  -            message=null
[2011-11-03 09:43:21,968] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:171) -  -         remoteUser=null
[2011-11-03 09:43:21,968] INFO  (org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]:172) -  -             status=500

你知道这意味着什么吗?我把一些日志放入合同服务本身,我没有看到它们,所以请求可能有些问题?

2 个答案:

答案 0 :(得分:1)

是的,这是对的。因为这会抽象出你有一个负载均衡器的事实,你可以在将来实际添加越来越多的节点而不会改变任何东西

答案 1 :(得分:0)

您说您的应用程序服务器无法访问loadbalancer。您的群集节点是否正在尝试达到策略定位的负载均衡器并且无法执行此操作?

如果这是问题,您可以尝试使用相对URI进行绘图。

您也可以尝试修复schemaLocation="schemaLocation="http:...字符串。