Author Message
KarlBurnam2
Joined: Nov 11, 2013
Messages: 58
Offline
I have a complex web service request. I filled out and populated the request in java but when I attempt to run it with the WSOP file here is the error I receive:

17/12/2013 10:41:44:751 DEBUG - 92E54F9C4921B3393E0BFF7748A23721:/RegE : Collecting [connectivity.ws.beans.IdentifyMember.GatewayStub$IdentifyMemberRequest@17c1b71] from:request
17/12/2013 10:41:45:512 ERROR - 92E54F9C4921B3393E0BFF7748A23721:/RegE : Got AxisFault during web service call: Transport error: 415 Error: Cannot process the message because the content type 'text/xml; charset=UTF-8' was not the expected type 'application/soap+xml; charset=utf-8'.
17/12/2013 10:41:45:532 INFO - 92E54F9C4921B3393E0BFF7748A23721:/RegE : Capturing exception [org.apache.axis2.AxisFault]. Message [Transport error: 415 Error: Cannot process the message because the content type 'text/xml; charset=UTF-8' was not the expected type 'application/soap+xml; charset=utf-8'.]
17/12/2013 10:41:45:562 ERROR - 92E54F9C4921B3393E0BFF7748A23721:/RegE : session id:sess9790219 | Error processing request
EXCEPTION>

How can I change the content type of the request?
SamareshKowshik
Joined: Nov 6, 2013
Messages: 351
Offline
Can you post your Java code here?
Anonymous

Here is the code (I am just setting the complex variable and then using the WSOP file to send the web service request):

public void servletImplementation(com.avaya.sce.runtimecommon.SCESession mySession) {
//OD Variables for account info/SSN
IVariableField SSN = mySession.getVariableField(IProjectVariables.COLLECT_LAST_4SSN, IProjectVariables.COLLECT_LAST_4SSN_FIELD_VALUE);
IVariableField Account_Number = mySession.getVariableField(IProjectVariables.COLLECT_ACCT_NUM, IProjectVariables.COLLECT_ACCT_NUM_FIELD_VALUE);
//IVariableField Request = mySession.getVariableField(IProjectVariables.REQUEST);

//Setting Up Request
IdentifyMember IM = new IdentifyMember();



//Pulling in Web Request Java Variables

IdentifyMemberRequest Identify_Member_Request = new IdentifyMemberRequest();

//Pulling SSFCU header object from Identify Member
SSFCUHeader Header = new SSFCUHeader();
//Setting SSFCU header object for request
Header.setApplicationName("IVRCallPlus");
Header.setApplicationVersion("1.0");
System.out.println("Application name = " + Header.getApplicationName());
Identify_Member_Request.setSSFCUHeader(Header);
IM.setRequest(Identify_Member_Request);

//Setting Mixed Identifier
//Identify_Member_Request.setMixedIdentifier(Account_Number.getStringValue());
//Setting SSN
//Identify_Member_Request.setSSN(SSN.getStringValue());
mySession.getVariable(IProjectVariables.IDENTIFY_MEMBER).getSimpleVariable().setValue(IM);

}


I did some digging and it appears that application/soap+xml is a Soap 1.2 standard, does the Axis 2 adapter support this?
Anonymous

Axis2 can use both the SOAP 1.1 and 1.2 specifications, and usually defaults to 1.2. It seems here that the opposite has happened, namely it is trying to send a SOAP 1.1 request instead of 1.2. What does your WSDL look like? The transport error is only going to happen once the client has contacted the web service, so there is some sort of disconnect between the two. Is this the latest version of the WSDL? Has maybe the web service changed at all?
SamareshKowshik
Joined: Nov 6, 2013
Messages: 351
Offline
Sorry if this shows up as a duplicate past, but the last time I posted I wasn't logged in, and Anonymous posts might get deleted.

Axis2 can use both the SOAP 1.1 and 1.2 specifications, and usually defaults to 1.2. It seems here that the opposite has happened, namely it is trying to send a SOAP 1.1 request instead of 1.2. What does your WSDL look like? The transport error is only going to happen once the client has contacted the web service, so there is some sort of disconnect between the two. Is this the latest version of the WSDL? Has maybe the web service changed at all?
KarlBurnam2
Joined: Nov 11, 2013
Messages: 58
Offline
The Web Service has not changed. I will PM you a copy of the WSDL file. Is there a way we can set the OD WSOP file to use Soap 1.2?
KarlBurnam2
Joined: Nov 11, 2013
Messages: 58
Offline
I was looking through the stub that was generated from the WSDL and it appears to be set to Soap 1.2:

//Set the soap version
_serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);


However when the request is sent out it defaults to Soap 1.1. Is there a way we can force Soap 1.2 from a WSOP file?

SamareshKowshik
Joined: Nov 6, 2013
Messages: 351
Offline
No, there's no way to manually set stub options without writing Java. The web service client that OD uses is created and destroyed for each web service call, and there is no mechanism to interrupt that process to change values. You can, however, invoke the web service stub directly from Java. You have all the input parameter code there written already, so it's a matter of adding the actual invocation. An example is given below, in case you aren't familiar with how to do it. There is a line included to set the SOAP version to 1.2.


public void servletImplementation(com.avaya.sce.runtimecommon.SCESession mySession) {

// The request objects that have to be created
SetPinByMaskAndPhoneRequest request = new SetPinByMaskAndPhoneRequest();
SetPinByMaskAndPhoneRequestDataType data = new SetPinByMaskAndPhoneRequestDataType();
CardMaskAndPhonePair pair = new CardMaskAndPhonePair();
CardLastDigitMask cardDigit = new CardLastDigitMask();
PhoneNumber num = new PhoneNumber();

// Set values
cardDigit.setCardLastDigitMask("mask value");
num.setPhoneNumber("phone number");

// Set values
pair.setCardMask(cardDigit);
pair.setPhone(num);

// Set values
data.setCardMaskAndPhone(pair);
data.setPinDeliveryMethod(PinDeliveryMethodType.SMS);

// Set request object with the above nested objects
request.setSetPinByMaskAndPhoneRequest(data);

// Create response object
SetPinByMaskAndPhoneResponse response = null;

// Try/catch for the web service call
try {
// Create the stub object
SvGateStub stub = new SvGateStub();

// Set the SOAP12 version, just in case
stub._getServiceClient().getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);

// Invoke the web service client and store the response object
response = stub.setPinByMaskAndPhone(request);
} catch (AxisFault e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (ServiceLevelException e) {
e.printStackTrace();
} catch (SVFEProcessingExceptionException e) {
e.printStackTrace();
}

// Get response values and set to OD variables
if(response != null) {
int code = response.getSetPinByMaskAndPhoneResponse().getCode();
mySession.getVariableField(IProjectVariables.SET_PIN_BY_MASK_AND_PHONE_RESPONSE_FIELD_CODE).setValue(code);
}
}
KarlBurnam2
Joined: Nov 11, 2013
Messages: 58
Offline
That helped to get past the first error. I am now receiving a message from the web service asking for a SOAP action message. I noticed this gets created in the WSOP file, how can I create it without using the WSOP?

SamareshKowshik
Joined: Nov 6, 2013
Messages: 351
Offline
You can set the SOAP action by using the following line. It should be inserted before the stub is executed, basically.


stub._getServiceClient().getOptions().setAction("SOAP Action Here");
Go to:   
Mobile view