cancel
Showing results for 
Search instead for 
Did you mean: 

Adaptor Module creating wrong version of class

Former Member
0 Kudos

Hi Guys,

I wonder if anyone can possibly shed any light on the following problem.

I am trying to create an instance of apache Axis' MessageFactory

However every time the Adaptor Module (Called ClientAuthentication) is called the following class is created - copied from the Message Display Tool

ClientAuthentication: com.sap.engine.services.webservices.jaxm.soap.MessageFactoryImpl created

I have the following in my imports


import org.apache.axis.soap.MessageFactoryImpl;
import javax.xml.soap.SOAPBody; 
import javax.xml.soap.SOAPEnvelope; 
import javax.xml.soap.SOAPHeader; 
import javax.xml.soap.SOAPMessage; 
import javax.xml.soap.SOAPPart; 

And, at this stage, I have explicitly referenced the axis class when creating the instance:


// MessageFactory mf = MessageFactory.newInstance();
// Creating com.sap.engine.services.webservices.jaxm.soap.SOAPMessageImpl
javax.xml.soap.MessageFactory mf= org.apache.axis.soap.MessageFactoryImpl.newInstance();
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "ClientAuthentication: " + mf.getClass().getName() + " created");

Looking at the class in the exported EJB via a decompiler shows


MessageFactory mf = MessageFactoryImpl.newInstance();
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "ClientAuthentication: " + mf.getClass().getName() + " created");

And the result is a com.sap.engine.services.webservices.jaxm.soap.MessageFactoryImpl is created resulting in the wrong SOAPMessage which crashes when returning it's SOAPPart

Any help would be appreciated,

John

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

It is possible to bypass the call to an implementation of MessageFactory and ensure the axis library is used to create the SOAPEnvelope using


org.apache.axis.message.SOAPEnvelope env = new org.apache.axis.message.SOAPEnvelope();
env.setSAAJEncodingCompliance(true);
org.apache.axis.Message iSoapMessage = new org.apache.axis.Message(env);
iSoapMessage.setMessageType("request");
SOAPMessage sm = iSoapMessage;

Instead of


javax.xml.soap.MessageFactory mf= org.apache.axis.soap.MessageFactoryImpl.newInstance();
SOAPMessage sm = mf.createMessage();

Which wasn't returning the right implementation of MessageFactory and hence SOAPEnvelope.

The addDocument to the SOAPBody is still crashing the same way, but this questionis answered.

All the best,

John

Former Member
0 Kudos

Hi,

Thanks for your reply.

I'm actually not getting an error when creating the MessageFactory, but it's not creating the implementation of MessageFactory I want. SAP is using the classes from com.sap.engine.services.webservices.jaxm.soap instead of org.apache.axis.soap, even though I've explicitly told it to use the Axis classes.

With the SAP classes problems occur later down the code when I attempt to convert the instance of SOAPPart to a document, or when adding a document to the body returned from SOAPEnvelope.

Kind regards,

John

Former Member
0 Kudos

Dear John,

What error you got while using MessageFactory mf = MessageFactory.newInstance()

Regards,

UDR