Announcement Announcement Module
Collapse
No announcement yet.
Spring WebService Error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring WebService Error

    Hi,
    I had developed Spring web service without security. I was success.

    Now i am adding the security.

    At the client side the configuration was

    <bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServi ceTemplate"
    p:marshaller-ref="jaxbMarshaller" p:unmarshaller-ref="jaxbMarshaller"
    p:defaultUri="http://localhost:6666/springwebservice/ReportService"
    p:messageSender-ref="messageSender">
    <constructor-arg ref="messageFactory" />

    <property name="interceptors">
    <list>
    <ref local="wsSecurityInterceptor" />
    </list>
    </property>
    </bean>

    <bean id="messageSender"
    class="org.springframework.ws.transport.http.Commo nsHttpMessageSender" />

    <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMe ssageFactory" />

    <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r"
    p:contextPath="com.cscinfo.nameprotect.webservice" />

    <bean id="wsSecurityInterceptor"
    class="org.springframework.ws.soap.security.wss4j. Wss4jSecurityInterceptor">
    <property name="securementActions" value="Encrypt" />
    <property name="securementEncryptionUser" value="csc" />
    <property name="securementEncryptionCrypto">
    <bean
    class="org.springframework.ws.soap.security.wss4j. support.CryptoFactoryBean">
    <property name="keyStorePassword" value="asdf" />
    <property name="keyStoreLocation" value="/META-INF/keystore/mykey.jks" />
    </bean>
    </property>
    </bean>

    I had successfully encripted the message.
    The resultant message is

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><SOAP-ENV:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1"><xenc:EncryptedKey Id="EncKeyId-DEDEC4EE443198A43113624912874062" 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 xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><ds:X509Data>
    <ds:X509IssuerSerial>
    <ds:X509IssuerName>CN=Pavan Kumar,OU=TSC,O=MYT,L=HYD,ST=AP,C=IN</ds:X509IssuerName>
    <ds:X509SerialNumber>1362478771</ds:X509SerialNumber>
    </ds:X509IssuerSerial>
    </ds:X509Data></wsse:SecurityTokenReference>
    </ds:KeyInfo><xenc:CipherData><xenc:CipherValue>VqJa XJ3NDbN1TnKErmxopHYDyNn3Vmkkwm6JOkHu7aPTvJchyD9rYW faSPZa+g5feWZLo9yAD+p2CnTvoL9z5bZVnP3GeweoFYSQP0Bl pl52F2mZ0QfrASZ56+oT8Anu0cGu17ItFXPvegIhg7JBTXQbd9 e+3cvZCkdLGiMKMAd/CnyZOmOsqgceYXFB1iU2bHB7KPFUce0NanmmVkK5VsVs8PgArc ZkSnV/hvRGM9jvOHJ3PpTc30znJFhWzc3KTIhi6MO0HjNgr2h90AN/khKdvWnd+VT1yVmkaEkj2JM5xDquSX62GuC4CBzl7dpBXSsl3e 8xByUxQRBgx2Szwg==</xenc:CipherValue></xenc:CipherData><xenc:ReferenceList><xencataReference URI="#EncDataId-1"/></xenc:ReferenceList></xenc:EncryptedKey></wsse:Security></SOAP-ENV:Header><SOAP-ENV:Body><xenc:EncryptedData Id="EncDataId-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 xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:Reference URI="#EncKeyId-DEDEC4EE443198A43113624912874062" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/></wsse:SecurityTokenReference>
    </ds:KeyInfo><xenc:CipherData><xenc:CipherValue>SjHy nvMSrDDztfQ6qfByJOG/D0Rr+6pqimB8evYFRY7HsqyaNpcHMw8qQM7z/ez1bJzv+6Dz2Eiu
    XX+ppnEFwsKGMtL1zQ+0VcsgwaUJjf79MyLH2lpLHfZ5tNk4ez KhQZBimuXXBIcrklhJMNTQQrCd
    1cfqifcXcm2wdjXSk/0iVQAkOKl101J9L2SouNRJ6cUuZry0EgaA8TYKr/Wq2eQidvAbP6r23Tsy
    s+4JaNX6m3TnB8FtOm5f1tNu+fgbCtaypw8g4j9Nwhi3vwv/8994tzeIOpXho5m0GBNKqEngbnzk
    Gi6slJaNuQBfK98PPuRnxafOkq+EwxPPRJQFaffVAN0JTdGiyG mc7XB5yhQSY8AWL+CU6xBFuQyp
    N7WTxZcf/roK2pef1RQucaBWjHrH+WxkL5Vff1uVNivHyFxYoJGJNbVgg0j jAvikTMKq9/vKBM4Q
    tuybi676YFS5HbMhOnI9uNqdaMZ9CUP20DhJL3Oqfy2g3pOISq 8qXTVzi00MiQHnyfq4KsrZReOl
    g0TDLz8MMdhSUQNec7vTDpcOV5f8XWpGW+GU5GkkKmqKgkk028 UPsoab5j+T3ZxUl3XYxeqdUqAG
    bdWgLsaNCxYuQxgunG3ZoiB5xbqHz0VTSs3K5+X9gpEkvkc5v1 K8KBlHWWUNgEGmoTeETSGoafRT
    SgrBdfJGqSKYL+81gyGkWlqbBcOMrJl1urKBCrAM5TaK7rJTPj 2X5W2L1xqtJzG7hCOayLJD+tFI
    SM1N21WJqtRIGzHk1oEvfzZ1aUml8xNIdDN3c3LHnNW88MMLWQ bbYlQ2VuJyE38NeyzGHEXc1jWN
    L/gwrnbC5W/04cBsCqLcqwue83FQ5YRVofTb2k8czBM4Z5gr1nB1p8uSh7J97 FG03nDeAaFYwG+A
    Ai8JRw==</xenc:CipherValue></xenc:CipherData></xenc:EncryptedData></SOAP-ENV:Body></SOAP-ENV:Envelope>


    The Server side configuration was:

    <sws:dynamic-wsdl id="ReportyService"
    portTypeName="ReportService" locationUri="/reportService"
    targetNamespace="http://com/cscinfo/nameprotect/webservices/reporService">
    <sws:xsd location="/schemas/ReportOperations.xsd" />
    </sws:dynamic-wsdl>

    <sws:interceptors>

    <bean
    class="org.springframework.ws.soap.security.wss4j. Wss4jSecurityInterceptor">
    <property name="validationActions" value="Encrypt" />
    <property name="validationDecryptionCrypto">
    <bean
    class="org.springframework.ws.soap.security.wss4j. support.CryptoFactoryBean">
    <property name="keyStorePassword" value="asdf" />
    <property name="keyStoreLocation" value="/keystore/mykey.jks" />
    </bean>
    </property>
    <property name="validationCallbackHandler">
    <bean
    class="org.springframework.ws.soap.security.wss4j. callback.KeyStoreCallbackHandler">
    <property name="privateKeyPassword" value="123456" />
    </bean>
    </property>
    </bean>

    <bean id="validatingInterceptor"
    class="org.springframework.ws.soap.server.endpoint .interceptor.PayloadValidatingInterceptor">
    <property name="schema" value="/schemas/ReportOperations.xsd" />
    <property name="validateRequest" value="true" />
    <property name="validateResponse" value="true" />
    </bean>


    <bean id="loggingInterceptor"
    class="org.springframework.ws.server.endpoint.inte rceptor.PayloadLoggingInterceptor" />

    </sws:interceptors>

    <bean id="exceptionResolver"
    class="org.springframework.ws.soap.server.endpoint .SoapFaultMappingExceptionResolver">
    <property name="defaultFault" value="SERVER" />
    <property name="exceptionMappings">
    <value>
    org.springframework.oxm.ValidationFailureException =CLIENT,Invalid
    request
    </value>
    </property>
    </bean>

    But i am getting the exception as below;

    Exception in thread "main" org.springframework.ws.client.WebServiceTransportE xception: Not Found [404]

    Anyone please indicate what wrong i did on server side
Working...
X