Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java apachecxf+;soap匿名寻址_Java_Soap_Wsdl_Apache Camel_Cxf - Fatal编程技术网

Java apachecxf+;soap匿名寻址

Java apachecxf+;soap匿名寻址,java,soap,wsdl,apache-camel,cxf,Java,Soap,Wsdl,Apache Camel,Cxf,我不熟悉Soap寻址,必须将wsa寻址与ApacheCxf+camel一起使用 这是apache cxf从wsdl创建的服务端点 @WebMethod(operationName = "Inventory_SubmitResult", action = "http://htng.org/PWSWG/2010/12/Inventory_SubmitResult") @Action(input = "http://htng.org/PWSWG/2010/12/Inventory_SubmitResu

我不熟悉Soap寻址,必须将wsa寻址与ApacheCxf+camel一起使用

这是apache cxf从wsdl创建的服务端点

@WebMethod(operationName = "Inventory_SubmitResult", action = "http://htng.org/PWSWG/2010/12/Inventory_SubmitResult")
@Action(input = "http://htng.org/PWSWG/2010/12/Inventory_SubmitResult", output = "http://htng.org/PWSWG/2010/12/Inventory_SubmitResultResponse")
public void inventorySubmitResult(
    @WebParam(partName = "OTA_HotelInvCountNotifRS", mode = WebParam.Mode.INOUT, name = "OTA_HotelInvCountNotifRS", targetNamespace = "http://www.opentravel.org/OTA/2003/05")
    javax.xml.ws.Holder<OTAHotelInvCountNotifRS> otaHotelInvCountNotifRS
);
我面临的问题是,传入请求中的ReplyTo标头的值低于此值

 <wsa:ReplyTo>
            <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
 </wsa:ReplyTo>
我试过下面的东西

  • 更改soap2:Header中wsa的名称空间值,如下和 它起作用了

    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
    
  • 更改“回复到地址”值(如下所示)后,它就可以工作了
  • 正在删除ReplyTo标头
  • 但我不能做这一切,因为要求来自第三方

    我尝试在请求中编辑(删除replyto头/更新replyto头中的地址节点值)soap头,方法是将拦截器置于PRE_逻辑阶段,但没有成功

       public class WsaHeaderInterceptor extends AbstractSoapInterceptor {
    
        public WsaHeaderInterceptor(String replyToUrlTemplate, MessageType messageType) {
            super(Phase.PRE_LOGICAL);
        }
    
        @Override
        public void handleMessage(SoapMessage message) throws Fault {
            //hard-coded for debugging
            Header header = message.getHeaders().remove(1);
    
                    ((Element) (header.getObject())).getFirstChild().getNextSibling().getFirstChild()
                          .setNodeValue("" + "http://www.w3.org/2005/08/addressing/anonymous");
    
                    ((Element) (header.getObject())).getFirstChild().getNextSibling().getFirstChild()
                         .setTextContent("" + "http://www.w3.org/2005/08/addressing/anonymous");
    
        }
    }
    
    花了好几天时间在这上面,但无法修复,任何线索或指针都会很有帮助

    WSDL文件

        <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://synxis.com/Ota2010a/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="OTA2010A" targetNamespace="http://synxis.com/Ota2010a/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <wsp:Policy wsu:Id="ota2010AEndpoint_policy">
        <wsp:ExactlyOne>
          <wsp:All>
            <wsaw:UsingAddressing />
          </wsp:All>
        </wsp:ExactlyOne>
      </wsp:Policy>
      <wsdl:types>
        <xs:schema xmlns:tns="http://www.opentravel.org/OTA/2003/05" elementFormDefault="qualified" targetNamespace="http://www.opentravel.org/OTA/2003/05" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <!--removed types -->
      </wsdl:types>
    
      <wsdl:message name="InvCountDeliveryResponse">
        <wsdl:part xmlns:q1="http://www.opentravel.org/OTA/2003/05" name="OTA_HotelInvCountNotifRS"
                element="q1:OTA_HotelInvCountNotifRS" />
      </wsdl:message>
      <wsdl:message name="InvCountDeliveryResponse_Headers">
        <wsdl:part xmlns:q2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" name="Security" element="q2:Security" />
        <wsdl:part xmlns:q3="http://htng.org/1.3/Header/" name="TimeStamp" element="q3:TimeStamp" />
        <wsdl:part xmlns:q4="http://htng.org/PWSWG/2007/02/AsyncHeaders" name="CorrelationID" element="q4:CorrelationID" />
        <wsdl:part xmlns:q5="http://htng.org/PWSWG/2007/02/AsyncHeaders" name="RelatesToCorrelationID" element="q5:RelatesToCorrelationID" />
        <wsdl:part xmlns:q6="http://htng.org/PWSWG/2007/02/AsyncHeaders" name="ReplyTo" element="q6:ReplyTo" />
      </wsdl:message>
    
      <wsdl:message name="InventoryCountResponse">
        <wsdl:part xmlns:q7="http://www.opentravel.org/OTA/2003/05" name="OTA_HotelInvCountNotifRS" element="q7:OTA_HotelInvCountNotifRS" />
      </wsdl:message>
      <wsdl:message name="InventoryCountResponse_Headers">
        <wsdl:part xmlns:q8="http://htng.org/1.3/Header/" name="TimeStamp" element="q8:TimeStamp" />
      </wsdl:message>
    
      <wsdl:portType name="IOta2010A">
        <!-- Adding Inbound for Async Response starts here -->
        <wsdl:operation name="Inventory_SubmitResult">
          <wsdl:input wsaw:Action="http://htng.org/PWSWG/2010/12/Inventory_SubmitResult" name="InvCountDeliveryResponse" message="tns:InvCountDeliveryResponse" />
          <wsdl:output wsaw:Action="http://htng.org/PWSWG/2010/12/Inventory_SubmitResultResponse" name="InventoryCountResponse" message="tns:InventoryCountResponse" />
        </wsdl:operation>
      </wsdl:portType>
    
      <wsdl:binding name="ota2010AEndpoint" type="tns:IOta2010A">
        <wsp:PolicyReference URI="#ota2010AEndpoint_policy" />
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="Inventory_SubmitResult" >
          <soap12:operation soapAction="http://htng.org/PWSWG/2010/12/Inventory_SubmitResult" style="document" />
          <wsdl:input name="InvCountDeliveryResponse">
            <soap12:header message="tns:InvCountDeliveryResponse_Headers" part="Security" use="literal" />
            <soap12:header message="tns:InvCountDeliveryResponse_Headers" part="TimeStamp" use="literal" />
            <soap12:header message="tns:InvCountDeliveryResponse_Headers" part="RelatesToCorrelationID" use="literal" />
            <soap12:header message="tns:InvCountDeliveryResponse_Headers" part="ReplyTo" use="literal" />
            <soap12:body use="literal" />
          </wsdl:input>
          <wsdl:output name="InventoryCountResponse">
            <soap12:header message="tns:InventoryCountResponse_Headers" part="TimeStamp" use="literal" />
            <soap12:body use="literal" />
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
    
      <wsdl:service name="OTA2010A">
          <wsdl:port name="ota2010AEndpoint" binding="tns:ota2010AEndpoint">
             <soap12:address location="https://integcert.synxis.com/Interface/ota2010av2/OTA2010A.svc"/>
             <wsa10:EndpointReference>
                <wsa10:Address>https://integcert.synxis.com/Interface/ota2010av2/OTA2010A.svc</wsa10:Address>
             </wsa10:EndpointReference>
          </wsdl:port>
       </wsdl:service>
    </wsdl:definitions>
    
    
    https://integcert.synxis.com/Interface/ota2010av2/OTA2010A.svc
    
    并不能真正回答这个问题,但希望这些信息能有用:

    因此请求者使用
    http://www.w3.org/2005/08/addressing
    名称空间,然后指定
    http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
    URI

    schemas.xmlsoap.org
    名称空间用于SOAP 1.1。而
    www.w3.org“
    名称空间用于SOAP 1.2

    然而,报告说SOAP1.2应该是向后兼容的

    WS-Addressing符合SOAP 1.2消息传递框架处理模型,并且还与SOAP 1.1兼容以实现向后兼容性

    它看起来确实像
    http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
    URI通过
    org.apache.CXF.ws.addressing.VersionTransformer
    类在CXF中识别


    请求中的寻址似乎应该是有效的,并且应该被CXF理解。

    您可以添加wsdl吗?@delephin添加了wsdl文件
       public class WsaHeaderInterceptor extends AbstractSoapInterceptor {
    
        public WsaHeaderInterceptor(String replyToUrlTemplate, MessageType messageType) {
            super(Phase.PRE_LOGICAL);
        }
    
        @Override
        public void handleMessage(SoapMessage message) throws Fault {
            //hard-coded for debugging
            Header header = message.getHeaders().remove(1);
    
                    ((Element) (header.getObject())).getFirstChild().getNextSibling().getFirstChild()
                          .setNodeValue("" + "http://www.w3.org/2005/08/addressing/anonymous");
    
                    ((Element) (header.getObject())).getFirstChild().getNextSibling().getFirstChild()
                         .setTextContent("" + "http://www.w3.org/2005/08/addressing/anonymous");
    
        }
    }
    
        <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://synxis.com/Ota2010a/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="OTA2010A" targetNamespace="http://synxis.com/Ota2010a/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <wsp:Policy wsu:Id="ota2010AEndpoint_policy">
        <wsp:ExactlyOne>
          <wsp:All>
            <wsaw:UsingAddressing />
          </wsp:All>
        </wsp:ExactlyOne>
      </wsp:Policy>
      <wsdl:types>
        <xs:schema xmlns:tns="http://www.opentravel.org/OTA/2003/05" elementFormDefault="qualified" targetNamespace="http://www.opentravel.org/OTA/2003/05" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <!--removed types -->
      </wsdl:types>
    
      <wsdl:message name="InvCountDeliveryResponse">
        <wsdl:part xmlns:q1="http://www.opentravel.org/OTA/2003/05" name="OTA_HotelInvCountNotifRS"
                element="q1:OTA_HotelInvCountNotifRS" />
      </wsdl:message>
      <wsdl:message name="InvCountDeliveryResponse_Headers">
        <wsdl:part xmlns:q2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" name="Security" element="q2:Security" />
        <wsdl:part xmlns:q3="http://htng.org/1.3/Header/" name="TimeStamp" element="q3:TimeStamp" />
        <wsdl:part xmlns:q4="http://htng.org/PWSWG/2007/02/AsyncHeaders" name="CorrelationID" element="q4:CorrelationID" />
        <wsdl:part xmlns:q5="http://htng.org/PWSWG/2007/02/AsyncHeaders" name="RelatesToCorrelationID" element="q5:RelatesToCorrelationID" />
        <wsdl:part xmlns:q6="http://htng.org/PWSWG/2007/02/AsyncHeaders" name="ReplyTo" element="q6:ReplyTo" />
      </wsdl:message>
    
      <wsdl:message name="InventoryCountResponse">
        <wsdl:part xmlns:q7="http://www.opentravel.org/OTA/2003/05" name="OTA_HotelInvCountNotifRS" element="q7:OTA_HotelInvCountNotifRS" />
      </wsdl:message>
      <wsdl:message name="InventoryCountResponse_Headers">
        <wsdl:part xmlns:q8="http://htng.org/1.3/Header/" name="TimeStamp" element="q8:TimeStamp" />
      </wsdl:message>
    
      <wsdl:portType name="IOta2010A">
        <!-- Adding Inbound for Async Response starts here -->
        <wsdl:operation name="Inventory_SubmitResult">
          <wsdl:input wsaw:Action="http://htng.org/PWSWG/2010/12/Inventory_SubmitResult" name="InvCountDeliveryResponse" message="tns:InvCountDeliveryResponse" />
          <wsdl:output wsaw:Action="http://htng.org/PWSWG/2010/12/Inventory_SubmitResultResponse" name="InventoryCountResponse" message="tns:InventoryCountResponse" />
        </wsdl:operation>
      </wsdl:portType>
    
      <wsdl:binding name="ota2010AEndpoint" type="tns:IOta2010A">
        <wsp:PolicyReference URI="#ota2010AEndpoint_policy" />
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="Inventory_SubmitResult" >
          <soap12:operation soapAction="http://htng.org/PWSWG/2010/12/Inventory_SubmitResult" style="document" />
          <wsdl:input name="InvCountDeliveryResponse">
            <soap12:header message="tns:InvCountDeliveryResponse_Headers" part="Security" use="literal" />
            <soap12:header message="tns:InvCountDeliveryResponse_Headers" part="TimeStamp" use="literal" />
            <soap12:header message="tns:InvCountDeliveryResponse_Headers" part="RelatesToCorrelationID" use="literal" />
            <soap12:header message="tns:InvCountDeliveryResponse_Headers" part="ReplyTo" use="literal" />
            <soap12:body use="literal" />
          </wsdl:input>
          <wsdl:output name="InventoryCountResponse">
            <soap12:header message="tns:InventoryCountResponse_Headers" part="TimeStamp" use="literal" />
            <soap12:body use="literal" />
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
    
      <wsdl:service name="OTA2010A">
          <wsdl:port name="ota2010AEndpoint" binding="tns:ota2010AEndpoint">
             <soap12:address location="https://integcert.synxis.com/Interface/ota2010av2/OTA2010A.svc"/>
             <wsa10:EndpointReference>
                <wsa10:Address>https://integcert.synxis.com/Interface/ota2010av2/OTA2010A.svc</wsa10:Address>
             </wsa10:EndpointReference>
          </wsdl:port>
       </wsdl:service>
    </wsdl:definitions>