Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

yashi jain

Greenhorn
+ Follow
since Jun 28, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by yashi jain

Hi Alna,

I've to implement this on weblogic server 9.2. anyways how is your suggestion help to resolve this validation error. How is clustering even related to this issue .

Thanks,
Yashi
8 years ago
Hi Dennis,

Thanks a lot for your help.I tried your suggestion (You're #1 approach is similar to what I do at work except for the part where you use
'<handler-chains xmlns="http://www.bea.com/xml/ns/jws">' from your SimpleChain.xml. I'm not sure if that is a requirement for you because you are using Oracle/BEA server? But that seems to be where the validation error is coming from (quoted below and in bold). Can you try changing this to '<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">' and see if that works? )

But it is still giving me below error:

[jwsc] C:\Documents and Settings\njain2\Release10_Handlers_POC\RxCWebServic
eGateway\src\com\cvs\rxconnect\resi\EnterprisePatientServicePortImpl.java 60:8
[jwsc] [ERROR] - javax.jws.WebService.endpointInterface com.cvs.rxconnect.r
esi.EnterprisePatientServicePort is invalid.
[jwsc] C:\Documents and Settings\njain2\Release10_Handlers_POC\RxCWebServic
eGateway\src\com\cvs\rxconnect\resi\EnterprisePatientServicePortImpl.java 60:8
[jwsc] [ERROR] - Handler chain file validation error for file: file:/C:/Doc
uments and Settings/njain2/Release10_Handlers_POC/RxCWebServiceGateway/src/com/c
vs/rxconnect/resi/SimpleChain.xml. C:\Documents and Settings\njain2\Release10_Ha
ndlers_POC\RxCWebServiceGateway\file:\C:\Documents and Settings\njain2\Release10
_Handlers_POC\RxCWebServiceGateway\src\com\cvs\rxconnect\resi\SimpleChain.xml:0:
error: The document is not a handler-config@http://www.bea.com/xml/ns/jws: docu
ment element mismatch got handler-chains@http://java.sun.com/xml/ns/javaee

[AntUtil.deleteDir] Deleting directory C:\DOCUME~1\njain2\LOCALS~1\Temp\_ha4pt

BUILD FAILED
C:\Documents and Settings\njain2\Release10_Handlers_POC\RxCWebServiceGateway\bui
ld.xml:160: weblogic.wsee.tools.WsBuildException: JWS Validation failed.

Total time: 28 seconds
8 years ago
Hi Ulf Dittmer,

Thanks a lot for your guidance.I really appreciate your help on this.

I've gone through the link provided in your reply(JAX-WS handlers), as well as before posting the query i went through the below SOAP handler tutorial from oracle :

http://docs.oracle.com/cd/E21764_01/web.1111/e13734/handlers.htm#

I tried to use 3 different approaches in order to implement the SOAP Handlers in my JWS, but i'm facing issues in all 3 of them and i'm sort of stuck with these issues.Please find the details below :

1) I added following annotation in my JWS file :

@WebService(serviceName = "EnterprisePatientService", targetNamespace = "http://www.rxconnect.cvs.com/resi", endpointInterface = "com.cvs.rxconnect.resi.EnterprisePatientServicePort")
@WLHttpTransport(contextPath = "RESI/PatientService", serviceUri = "EnterprisePatientService", portName = "EnterprisePatientServicePort")
@HandlerChain(file="SimpleChain.xml", name="SimpleChain")

Defined External Configuration file named(SimpleChain.xml) for handler chain :

<?xml version="1.0" encoding="UTF-8" ?>
<handler-chains xmlns="http://www.bea.com/xml/ns/jws">
<handler-chain>
<handler>
<handler-class>com.cvs.rxconnect.resi.Handler1</handler-class>
</handler>
</handler-chain>
</handler-chains>


Defined Handler Class(Handler1.java) as below to extract SOAP Message from request :

package com.cvs.rxconnect.resi;

import java.util.Collections;
import java.util.Set;

import javax.xml.namespace.QName;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;

public class Handler1 implements SOAPHandler<SOAPMessageContext> {

public Set<QName> getHeaders() {
return Collections.emptySet();
}

public void close(MessageContext arg0) {
// TODO Auto-generated method stub

}

public boolean handleFault(SOAPMessageContext arg0) {
// TODO Auto-generated method stub
return true;
}

public boolean handleMessage(SOAPMessageContext messageContext)
throws java.lang.RuntimeException {
Boolean outboundProperty = (Boolean) messageContext.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);

if (!outboundProperty.booleanValue()) {
System.out.println("\n Inbound Message:");
SOAPMessage soapMessage = messageContext.getMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
try {
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
System.out.println("Values in soapEnvelope are :" + soapEnvelope);
} catch (SOAPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return true;
}

}

I'm using Weblogic as Application Server.When i'm trying to build this project using JWSC ant task it gives following error:

[jwsc] [ERROR] - javax.jws.WebService.endpointInterface com.cvs.rxconnect.r
esi.EnterprisePatientServicePort is invalid.
[jwsc] C:\Documents and Settings\njain2\Release10_Handlers_POC\RxCWebServic
eGateway\src\com\cvs\rxconnect\resi\EnterprisePatientServicePortImpl.java 60:8
[jwsc] [ERROR] - Handler chain file validation error for file: file:/C:/Doc
uments and Settings/njain2/Release10_Handlers_POC/RxCWebServiceGateway/src/com/c
vs/rxconnect/resi/SimpleChain.xml. C:\Documents and Settings\njain2\Release10_Ha
ndlers_POC\RxCWebServiceGateway\file:\C:\Documents and Settings\njain2\Release10
_Handlers_POC\RxCWebServiceGateway\src\com\cvs\rxconnect\resi\SimpleChain.xml:0:
error: The document is not a handler-config@http://www.bea.com/xml/ns/jws: docu
ment element local name mismatch expected handler-config got handler-chains
[AntUtil.deleteDir] Deleting directory C:\DOCUME~1\njain2\LOCALS~1\Temp\_ha4pt

BUILD FAILED
C:\Documents and Settings\njain2\Release10_Handlers_POC\RxCWebServiceGateway\bui
ld.xml:160: weblogic.wsee.tools.WsBuildException: JWS Validation failed.

Total time: 21 seconds

2) Declared below annotation in my JWS file :

@WebService(serviceName = "EnterprisePatientService", targetNamespace = "http://www.rxconnect.cvs.com/resi", endpointInterface = "com.cvs.rxconnect.resi.EnterprisePatientServicePort")
@WLHttpTransport(contextPath = "RESI/PatientService", serviceUri = "EnterprisePatientService", portName = "EnterprisePatientServicePort")
@HandlerChain(file="SimpleChain.xml", name="SimpleChain")


SimpleChain.xml

<jwshc:handler-config xmlns:jwshc="http://www.bea.com/xml/ns/jws"
xmlns:soap1="http://HandlerInfo.org/Server1"
xmlns:soap2="http://HandlerInfo.org/Server2"
xmlns="http://java.sun.com/xml/ns/j2ee" >
<jwshc:handler-chain>
<jwshc:handler-chain-name>SimpleChain</jwshc:handler-chain-name>
<jwshc:handler>
<handler-name>handler1</handler-name>
<handler-class>com.cvs.rxconnect.resi.Handler1</handler-class>
</jwshc:handler>
</jwshc:handler-chain>
</jwshc:handler-config>


Handler1.java

package com.cvs.rxconnect.resi;

import java.util.Collections;
import java.util.Set;

import javax.xml.namespace.QName;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;

public class Handler1 implements SOAPHandler<SOAPMessageContext> {

public Set<QName> getHeaders() {
return Collections.emptySet();
}

public void close(MessageContext arg0) {
// TODO Auto-generated method stub

}

public boolean handleFault(SOAPMessageContext arg0) {
// TODO Auto-generated method stub
return true;
}

public boolean handleMessage(SOAPMessageContext messageContext)
throws java.lang.RuntimeException {
Boolean outboundProperty = (Boolean) messageContext.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);

if (!outboundProperty.booleanValue()) {
System.out.println("\n Inbound Message:");
SOAPMessage soapMessage = messageContext.getMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
try {
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
System.out.println("Values in soapEnvelope are :" + soapEnvelope);
} catch (SOAPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return true;
}

}


Error received while deploying tihs Webservice in Weblogic is attached in an attachment(Exception.bmp).

3) added below annotation in JWS file :

@WebService(serviceName = "EnterprisePatientService", targetNamespace = "http://www.rxconnect.cvs.com/resi", endpointInterface = "com.cvs.rxconnect.resi.EnterprisePatientServicePort")
@WLHttpTransport(contextPath = "RESI/PatientService", serviceUri = "EnterprisePatientService", portName = "EnterprisePatientServicePort")
@SOAPMessageHandlers ( {
@SOAPMessageHandler (
className="com.cvs.rxconnect.resi.Handler1")} )


Handler1.java code is :

package com.cvs.rxconnect.resi;

import java.util.Collections;
import java.util.Set;

import javax.xml.namespace.QName;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;

public class Handler1 implements SOAPHandler<SOAPMessageContext> {

public Set<QName> getHeaders() {
return Collections.emptySet();
}

public void close(MessageContext arg0) {
// TODO Auto-generated method stub

}

public boolean handleFault(SOAPMessageContext arg0) {
// TODO Auto-generated method stub
return true;
}

public boolean handleMessage(SOAPMessageContext messageContext)
throws java.lang.RuntimeException {
Boolean outboundProperty = (Boolean) messageContext.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);

if (!outboundProperty.booleanValue()) {
System.out.println("\n Inbound Message:");
SOAPMessage soapMessage = messageContext.getMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
try {
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
System.out.println("Values in soapEnvelope are :" + soapEnvelope);
} catch (SOAPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return true;
}

}


When i ran build.xml it gives below mentioned error:
[jwsc] C:\Documents and Settings\njain2\Release10_Handlers_POC\RxCWebServic
eGateway\src\com\cvs\rxconnect\resi\EnterprisePatientServicePortImpl.java 62:8
[jwsc] [ERROR] - The annotation javax.jws.soap.SOAPMessageHandlers is not a
llowed on com.cvs.rxconnect.resi.EnterprisePatientServicePortImpl when a javax.j
ws.WebService.endpointInterface is used.
[AntUtil.deleteDir] Deleting directory C:\DOCUME~1\njain2\LOCALS~1\Temp\_ha4pt

BUILD FAILED
C:\Documents and Settings\njain2\Release10_Handlers_POC\RxCWebServiceGateway\bui
ld.xml:160: weblogic.wsee.tools.WsBuildException: JWS Validation failed.

Total time: 1 minute 47 seconds

If you can provide me any further guidance on this, it will be really helpful.












8 years ago
Hi All,

I am using SOAP web service and i have generated the java stubs through WSDL using JAX-WS. I want to print the request and response SOAP XML in log file as well as store them in the database.
This is really urgent if someone can help me quickly , it will be greatly appreciated.

Thanks for your help and guidance.
Yashi Jain
8 years ago