Announcement Announcement Module
Collapse
No announcement yet.
Need help with setting soap action for target webservice Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with setting soap action for target webservice

    Hello,

    I am trying to call a secure webservice over SSL using spring integration and ws outbound gateway, I keep getting this error as a response from the service: if I disable SSL then the call to the service works fine.

    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><soap:Fault><soap:Code><soap: Value>soap:Sender</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">System.Web.Services.Protocols.SoapException: Unable to handle request without a valid action parameter. Please supply a valid soap action.
    at System.Web.Services.Protocols.Soap12ServerProtocol Helper.RouteRequest()
    at System.Web.Services.Protocols.SoapServerProtocol.I nitialize()

    at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)</soap:Text></soap:Reason><soapetail/></soap:Fault></soap:Body></soap:Envelope>

    this is the service "https://www.nfp.fazenda.sp.gov.br/ws/arquivocf.asmx"

    my configs are

    <bean id="wss4jSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j. Wss4jSecurityInterceptor">
    <property name="securementActions" value="Encrypt"/>
    <property name="securementEncryptionUser" value="pfe"/>
    <property name="securementMustUnderstand" value="false"/>
    <property name="secureRequest" value="true"/>
    <property name="securementEncryptionCrypto">
    <bean class="org.springframework.ws.soap.security.wss4j. support.CryptoFactoryBean">
    <property name="keyStorePassword" value="xyz"/>
    <property name="keyStoreLocation" value="file:/home/keystore.jks"/>
    </bean>
    </property>
    </bean>

    <util:list id="serviceInterceptors">
    <ref bean="authenticationInterceptor"/>
    <ref bean="wss4jSecurityInterceptor"/>

    </util:list>
    <!-- this is to append a soap header for authentication -->
    <bean id="authenticationInterceptor" class="com.xyz.AuthenticationInterceptor"/>
    <int:chain input-channel="in" output-channel="out">

    <int:transformer >
    <int-groovy:script><![CDATA[
    def writer = new StringWriter()
    def xml = new groovy.xml.MarkupBuilder(writer)

    xml.'ws:Enviar'('xmlns:ws':'https://www.nfp.sp.gov.br/ws') {
    NomeArquivo("file.txt")
    ConteudoArquivo("some content")
    EnvioNormal("1")
    Observacoes("comments")
    }

    writer.toString()
    ]]>
    </int-groovy:script>
    </int:transformer>
    <!-- I am setting the soap action here!!!!!-->
    <int-ws:header-enricher>
    <int-ws:soap-action value="https://www.nfp.sp.gov.br/ws/Enviar"/>
    </int-ws:header-enricher>

    </int:chain>
    <!-- need soap 1.2 to work -->
    <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMe ssageFactory">
    <property name="soapVersion">
    <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOA P_12"/>
    </property>
    </bean>



    <int-ws:outbound-gateway
    request-channel="out"
    reply-channel="otherChannel"
    uri="https://www.nfp.fazenda.sp.gov.br/ws/arquivocf.asmx"
    ignore-empty-responses="false"
    fault-message-resolver="nfpFaultResolver"
    interceptors="serviceInterceptors"
    message-factory="messageFactory">

    </int-ws:outbound-gateway>

    the soap action is "https://www.nfp.sp.gov.br/ws/Enviar " according to the WSDL. my understanding that the SI headers will be mapped to http headers if they are standard headers.

    also from the fault I receive, it seems that I am able to connect to the service and pass the SSL handshake and everything else since the fault seems coming from a .NET soap engine.

    Ideas?

  • #2
    This seems has to do with the order in which security is applied. it could be that the ssl interceptor order when applied is incorrect so the target service does not understand the message, a soap dump before sending the message seems to suggest that, is this a bug?

    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
    <env:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <xenc:EncryptedKey Id="EK-FF17E0332F5A16A2AB13414976215051" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
    <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
    <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <wsse:SecurityTokenReference>
    <ds:X509Data>
    <ds:X509IssuerSerial>
    <ds:X509IssuerName>CN=VeriSign Class 3 International Server CA - G3,OU=Terms of use at https://www.verisign.com/rpa (c)10,OU=VeriSign Trust Network,O=VeriSign\, Inc.,C=US</ds:X509IssuerName>
    <ds:X509SerialNumber>58734158243406108427577208624 010522177</ds:X509SerialNumber>
    </ds:X509IssuerSerial>
    </ds:X509Data>
    </wsse:SecurityTokenReference>
    </ds:KeyInfo>
    <xenc:CipherData>
    <xenc:CipherValue>AKSt880ZVh6GTnu0zYgbg+x8y0tlN3WY TAS2FV1gmbdzWA9V1efas+tzZLuYMkI0v9iEsv5ZxHCLOjpo48 KKjWYgM55Cpy4lcgcdXdvLPkuPhDiwOvSIGJo9e+5PNkoxgjPi aT8MhsF5n8WefPU2Rl9fN8BCJr385P7cAwQuhEOGXVXTsuSIaV h0UecYLrGU/VyELNHPrsSWHntsF8m/UYbj8n/AWTy1ieQfvoV5f4vaJpyUaMJ9QqHW6hOXo/DRLtKxp3b6yXC08X4Ri0qooNgrop+6X8MBKcLQeBY9lBW71pNX 0ze93ewcE5wGODdfbKYysd5guTL1UPENB7ozfg==</xenc:CipherValue>
    </xenc:CipherData>
    <xenc:ReferenceList>
    <xencataReference URI="#ED-1"/>
    </xenc:ReferenceList>
    </xenc:EncryptedKey>
    </wsse:Security>
    <ws:Autenticacao CNPJ="12345678901234" CategoriaUsuario="3" Senha="password" Usuario="someuser" xmlns:ws="https://www.nfp.sp.gov.br/ws"/>
    </env:Header>
    <env:Body>
    <xenc:EncryptedData Id="ED-1" Type="http://www.w3.org/2001/04/xmlenc#Content" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
    <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
    <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <wsse:SecurityTokenReference wsse11:TokenType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd">
    <wsse:Reference URI="#EK-FF17E0332F5A16A2AB13414976215051"/>
    </wsse:SecurityTokenReference>
    </ds:KeyInfo>
    <xenc:CipherData>
    <xenc:CipherValue>yzGArGVXoJjI0HnAstW9FMxXVjTPghwa KPSVHfGWuRVeHfEOs1koix7yrlLsK9Sa6KW71u65zddOemY7sD B+cCwcIOBG5MCPy2sDrTvjEImCI4umB25JmUTwV7PInU4BXG//x+GDuHVo5Fqjh+no8DppRASU194KhchoDNjIdf5OtvGCBdrFvz EK1u56GQQmb80iMq4Rqr7VgdbJ7gKM6HbSL14xrLkw5UZlEPqU G/Zjn/4E9oaFPwEC68e06mGnhuxyW+9MsuOdFa9xSQRb4AIqCKR8BEnQ 5JbE0psROV6r9aYVuje/fA9x0VzZ1MjQLsQ7qJwt/l4BTtnnnYE9Q9Z3E0AIdzolUfnc2WTilyadYuLKs+WhpK1qeCJ GM681wj7oDqJglfSgAk6v4u4g/Q==</xenc:CipherValue>
    </xenc:CipherData>
    </xenc:EncryptedData>
    </env:Body>
    </env:Envelope>

    Comment

    Working...
    X