|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Creating a SOAP request using .NET Compute Node |
« View previous topic :: View next topic » |
Author |
Message
|
djs |
Posted: Fri Dec 11, 2015 9:30 am Post subject: Creating a SOAP request using .NET Compute Node |
|
|
 Newbie
Joined: 25 Mar 2014 Posts: 5
|
I working in version 10.0.0.2 attempting to create a SOAP request using a .NET compute node. I have a working example using an esql compute node.
The message structure of both the .NET and esql requests look the same in the debugger prior to hitting the SOAP request node. The message from .NET is being sent out the
Failure terminal of the SOAP node. What I’ve noticed at that point is the message does not appear to be complete which is why it’s failing. What I don’t understand is why
the message is incomplete when it appears correct in the debugger. I think the problem might be with how I am creating the KeyValuePair elements but not really sure.
I have not been able to many .NET examples out there. Hoping someone might be able to provide some assistance here.
This is the how I am creating the SOAP request within .NET
Code: |
outputRoot.Delete();
outputRoot.CreateLastChildUsingNewParser(NBParsers.SOAP.ParserName);
outputRoot["SOAP"].CreateLastChild("Body");
outputRoot["SOAP"]["Body"].CreateLastChild(tns, "InvokeConnectwareRequest");
outputRoot["SOAP"]["Body"][tns, "InvokeConnectwareRequest"].CreateLastChild("Operation").SetValue("LNBillInq");
outputRoot["SOAP"]["Body"][tns, "InvokeConnectwareRequest"].CreateLastChild("Version").SetValue("1");
outputRoot["SOAP"]["Body"][tns, "InvokeConnectwareRequest"].CreateLastChild("Input");
outputRoot["SOAP"]["Body"][tns, "InvokeConnectwareRequest"]["Input"].CreateLastChild("KeyValuePair");
outputRoot["SOAP"]["Body"][tns, "InvokeConnectwareRequest"]["Input"]["KeyValuePair"].CreateLastChild("Key").SetValue("E30051");
outputRoot["SOAP"]["Body"][tns, "InvokeConnectwareRequest"]["Input"]["KeyValuePair"].CreateLastChild("Value").SetValue("0123456789");
outputRoot["SOAP"]["Body"][tns, "InvokeConnectwareRequest"]["Input"].CreateLastChild("KeyValuePair").CreateLastChild("Key").SetValue("E30054").CreateAfter("Key", "Value", "1");
outputRoot["SOAP"]["Body"][tns, "InvokeConnectwareRequest"]["Input"].CreateLastChild("KeyValuePair").CreateLastChild("Key").SetValue("E35105").CreateAfter("Key", "Value").SetValue("U"); |
Here is my message from the debugger prior to passing it to the SOAP request node.
Code: |
Message
SOAP
Body
InvokeConnectwareRequest
Operation:CHARACTER:LNBillInq
Version:CHARACTER:1
Input
KeyValuePair
Key:CHARACTER:E30051
Value:CHARACTER:0123456789
KeyValuePair
Key:CHARACTER:E30054
Value:CHARACTER:1
KeyValuePair
Key:CHARACTER:E35105
Value:CHARACTER:U |
This is what the message looks like coming off the FAILURE terminal of the SOAP request node
Code: |
Message
Properties
MessageSet:CHARACTER:
MessageType:CHARACTER:
MessageFormat:CHARACTER:
Encoding:INTEGER:546
CodedCharSetId:INTEGER:1208
Transactional:BOOLEAN:false
Persistence:BOOLEAN:false
CreationTime:TIMESTAMP:java.util.GregorianCalendar[time=1449865600429,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.
ZoneInfo[id="America/Chicago",offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.
SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,
startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],
firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=?,YEAR=2015,MONTH=11,WEEK_OF_YEAR=?,WEEK_OF_MONTH=?,DAY_OF_MONTH=11,DAY_OF_YEAR=?,
DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=?,AM_PM=1,HOUR=2,HOUR_OF_DAY=14,MINUTE=26,SECOND=40,MILLISECOND=429,ZONE_OFFSET=?,DST_OFFSET=?]
ExpirationTime:INTEGER:-1
Priority:INTEGER:0
ReplyIdentifier:BLOB:[B@60df451e
ReplyProtocol:CHARACTER:SOAP-AXIS2
Topic:UNKNOWN:null
ContentType:CHARACTER:text/xml; charset=utf-8
IdentitySourceType:CHARACTER:
IdentitySourceToken:CHARACTER:
IdentitySourcePassword:CHARACTER:
IdentitySourceIssuedBy:CHARACTER:
IdentityMappedType:CHARACTER:
IdentityMappedToken:CHARACTER:
IdentityMappedPassword:CHARACTER:
IdentityMappedIssuedBy:CHARACTER:
HTTPInputHeader
X-Original-HTTP-Command:CHARACTER:POST http://localhost:8088/ConnectwareGateway HTTP/1.1
Content-Length:CHARACTER:543
Content-Type:CHARACTER:text/xml; charset=utf-8
Host:CHARACTER:localhost:8088
SOAPAction:CHARACTER:""
Connection:CHARACTER:Keep-Alive
X-Remote-Addr:CHARACTER:127.0.0.1
X-Remote-Host:CHARACTER:127.0.0.1
X-Server-Name:CHARACTER:localhost
X-Server-Port:CHARACTER:8088
SOAP
Context
Envelope
NS1:CHARACTER:http://schemas.xmlsoap.org/soap/envelope/
Body
InvokeConnectwareRequest
NS2:CHARACTER:http://schemas.bancorp.com/services/connectwaregateway
Operation:CHARACTER:LNBillInq
Version:CHARACTER:1
Input
KeyValuePair
Key:CHARACTER:E30051
Value:CHARACTER:0123456789
KeyValuePair
Key:CHARACTER:E30054
Header
Envelope
NS1:CHARACTER:http://schemas.xmlsoap.org/soap/envelope/
Body
InvokeConnectwareRequest
NS2:CHARACTER:http://schemas.bancorp.com/services/connectwaregateway
Operation:CHARACTER:LNBillInq
Version:CHARACTER:1
Input
KeyValuePair
Key:CHARACTER:E30051
Value:CHARACTER:0123456789
KeyValuePair
Key:CHARACTER:E30054 |
This is the ExceptionList
Code: |
ExceptionList
RecoverableException
File:CHARACTER:F:\build\S1000_slot1\S1000_P\src\DataFlowEngine\MessageServices\ImbDataFlowNode.cpp
Line:INTEGER:1239
Function:CHARACTER:ImbDataFlowNode::createExceptionList
Type:CHARACTER:ComIbmSOAPInputNode
Name:CHARACTER:gen/ConnectwareGateway#FCMComposite_1_1
Label:CHARACTER:gen.ConnectwareGateway.SOAP Input
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Node throwing exception
Insert
Type:INTEGER:14
Text:CHARACTER:gen.ConnectwareGateway.SOAP Input
RecoverableException
File:CHARACTER:F:\build\S1000_slot1\S1000_P\src\WebServices\WSLibrary\ImbSOAPReplyNode.cpp
Line:INTEGER:416
Function:CHARACTER:ImbSOAPReplyNode::evaluate
Type:CHARACTER:ComIbmSOAPReplyNode
Name:CHARACTER:gen/ConnectwareGateway#FCMComposite_1_3
Label:CHARACTER:gen.ConnectwareGateway.SOAP Reply
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:3752
Text:CHARACTER:Error occurred in ImbSOAPReplyHelper::makeSOAPReply()
Insert
Type:INTEGER:14
Text:CHARACTER:gen.ConnectwareGateway.SOAP Reply
RecoverableException
File:CHARACTER:F:\build\S1000_slot1\S1000_P\src\WebServices\WSLibrary\ImbSOAPReplyHelper.cpp
Line:INTEGER:405
Function:CHARACTER:ImbSOAPReplyHelper::makeSOAPReply
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:3116
Text:CHARACTER:SOAP parser failed state - maybe there is an ExceptionList in the tree?
Insert
Type:INTEGER:5
Text:CHARACTER:gen/ConnectwareGateway#FCMComposite_1_3 |
For completeness here is the esql code used to generate the message that is working
Code: |
SET OutputRoot.SOAP.Body.tns:InvokeConnectwareRequest.Operation = 'LNBillInq';
SET OutputRoot.SOAP.Body.tns:InvokeConnectwareRequest.Version = '1';
SET OutputRoot.SOAP.Body.tns:InvokeConnectwareRequest.Input.KeyValuePair[1].Key = 'E30051';
SET OutputRoot.SOAP.Body.tns:InvokeConnectwareRequest.Input.KeyValuePair[1].Value = '0123456789';
SET OutputRoot.SOAP.Body.tns:InvokeConnectwareRequest.Input.KeyValuePair[2].Key = 'E30054';
SET OutputRoot.SOAP.Body.tns:InvokeConnectwareRequest.Input.KeyValuePair[2].Value = '1';
SET OutputRoot.SOAP.Body.tns:InvokeConnectwareRequest.Input.KeyValuePair[3].Key = 'E35105';
SET OutputRoot.SOAP.Body.tns:InvokeConnectwareRequest.Input.KeyValuePair[3].Value = 'U'; |
The esql message from the debugger prior to hitting the SOAP request node
Code: |
Message
Properties
MessageSet:UNKNOWN:null
MessageType:UNKNOWN:null
MessageFormat:UNKNOWN:null
Encoding:UNKNOWN:null
CodedCharSetId:UNKNOWN:null
Transactional:UNKNOWN:null
Persistence:UNKNOWN:null
CreationTime:UNKNOWN:null
ExpirationTime:UNKNOWN:null
Priority:UNKNOWN:null
ReplyIdentifier:UNKNOWN:null
ReplyProtocol:CHARACTER:SOAP-HTTP
Topic:UNKNOWN:null
ContentType:UNKNOWN:null
IdentitySourceType:UNKNOWN:null
IdentitySourceToken:UNKNOWN:null
IdentitySourcePassword:UNKNOWN:null
IdentitySourceIssuedBy:UNKNOWN:null
IdentityMappedType:UNKNOWN:null
IdentityMappedToken:UNKNOWN:null
IdentityMappedPassword:UNKNOWN:null
IdentityMappedIssuedBy:UNKNOWN:null
SOAP
Body
InvokeConnectwareRequest
Operation:CHARACTER:LNBillInq
Version:CHARACTER:1
Input
KeyValuePair
Key:CHARACTER:E30051
Value:CHARACTER:0123456789
KeyValuePair
Key:CHARACTER:E30054
Value:CHARACTER:1
KeyValuePair
Key:CHARACTER:E35105
Value:CHARACTER:U |
And here is the message coming off the OUT terminal of the SOAP request node
Code: |
Message
Properties
MessageSet:CHARACTER:
MessageType:CHARACTER:
MessageFormat:CHARACTER:
Encoding:INTEGER:546
CodedCharSetId:INTEGER:1208
Transactional:BOOLEAN:false
Persistence:BOOLEAN:false
CreationTime:TIMESTAMP:java.util.GregorianCalendar[time=1449866510858,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.
ZoneInfo[id="America/Chicago",offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.
SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,
startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,
endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=?,YEAR=2015,MONTH=11,WEEK_OF_YEAR=?,WEEK_OF_MONTH=?,DAY_OF_MONTH=11,
DAY_OF_YEAR=?,DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=?,AM_PM=1,HOUR=2,HOUR_OF_DAY=14,MINUTE=41,SECOND=50,MILLISECOND=858,ZONE_OFFSET=?,DST_OFFSET=?]
ExpirationTime:INTEGER:-1
Priority:INTEGER:0
ReplyIdentifier:BLOB:[B@faa7f108
ReplyProtocol:CHARACTER:SOAP-AXIS2
Topic:UNKNOWN:null
ContentType:CHARACTER:text/xml; charset=utf-8
IdentitySourceType:CHARACTER:
IdentitySourceToken:CHARACTER:
IdentitySourcePassword:CHARACTER:
IdentitySourceIssuedBy:CHARACTER:
IdentityMappedType:CHARACTER:
IdentityMappedToken:CHARACTER:
IdentityMappedPassword:CHARACTER:
IdentityMappedIssuedBy:CHARACTER:
HTTPInputHeader
X-Original-HTTP-Command:CHARACTER:POST http://localhost:8088/ConnectwareGateway HTTP/1.1
Content-Length:CHARACTER:495
Content-Type:CHARACTER:text/xml; charset=utf-8
Host:CHARACTER:localhost:8088
SOAPAction:CHARACTER:""
Connection:CHARACTER:Keep-Alive
X-Remote-Addr:CHARACTER:127.0.0.1
X-Remote-Host:CHARACTER:127.0.0.1
X-Server-Name:CHARACTER:localhost
X-Server-Port:CHARACTER:8088
XMLNSC
InvokeConnectwareRequest
NS2:CHARACTER:http://schemas.bancorp.com/services/connectwaregateway
Operation:CHARACTER:LNBillInq
Version:CHARACTER:1
Input
KeyValuePair
Key:CHARACTER:E30051
Value:CHARACTER:0123456789
KeyValuePair
Key:CHARACTER:E30054
Value:CHARACTER:1
KeyValuePair
Key:CHARACTER:E35105
Value:CHARACTER:U |
|
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Dec 11, 2015 1:56 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
This looks like some precursor to connectware. As I remember Connectware is much more involved with a different name space for each operation ...
Don't know if I would use OutputRoot.delete()...
And don't walk the tree... Use MbElement as a return from the Create method and use it as a reference (i.e. place holder).
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
djs |
Posted: Fri Dec 11, 2015 2:29 pm Post subject: |
|
|
 Newbie
Joined: 25 Mar 2014 Posts: 5
|
thanks fjb_saper.
Here is what I came up with and it works
Code: |
outputRoot.CreateLastChildUsingNewParser(NBParsers.SOAP.ParserName);
outputRoot["SOAP"].CreateLastChild("Body");
outputRoot["SOAP"]["Body"].CreateLastChild(tns, "InvokeConnectwareRequest");
outputRoot["SOAP"]["Body"][tns, "InvokeConnectwareRequest"].CreateLastChild("Operation").SetValue("LNBillInq");
outputRoot["SOAP"]["Body"][tns, "InvokeConnectwareRequest"].CreateLastChild("Version").SetValue("1");
var outRef = outputRoot["SOAP"]["Body"][tns, "InvokeConnectwareRequest"].CreateLastChild("Input");
outRef = outRef.CreateLastChild("KeyValuePair"); //Setting outRef to SOAP.Body.tns:InvokeConnectware.Input.KeyValuePair[1]
outRef.CreateLastChild("Key").SetValue("E30051");
outRef.CreateLastChild("Value").SetValue("0123456789");
outRef = outRef.Parent.CreateLastChild("KeyValuePair"); //Setting outRef to SOAP.Body.tns:InvokeConnectware.Input.KeyValuePair[2]
outRef.CreateLastChild("Key").SetValue("E30054");
outRef.CreateLastChild("Value").SetValue("1");
outRef = outRef.Parent.CreateLastChild("KeyValuePair"); //Setting outRef to SOAP.Body.tns:InvokeConnectware.Input.KeyValuePair[3]
outRef.CreateLastChild("Key").SetValue("E35105");
outRef.CreateLastChild("Value").SetValue("U"); |
|
|
Back to top |
|
 |
mgk |
Posted: Mon Dec 14, 2015 3:55 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
So your solution should work fine. However, for the record, here are a couple of functions I wrote that do something similar but with a few differences to yours - Firstly I set the soap namespace in the "Context" folder under the SOAP tree so I can specify the namespace prefix used for soap (I used 'soap-env'). Secondly, I use the overridden form of CreateLastChild so I don't need to call "SetValue(...)".
Code: |
void BuildOutputMessage(NBElement outputRoot, string operationName, string operationNamespace, int result)
{
//create the output message
NBElement outputData = outputRoot.CreateLastChildUsingNewParser("SOAP");
outputData.CreateLastChild("Context").CreateLastChild("Namespace").CreateLastChild(SOAP.SingleNamespaceDeclaration, "xmlns", "soap-env", "http://schemas.xmlsoap.org/soap/envelope/");
outputData = outputData.CreateLastChild("Body");
outputData.CreateLastChild(SOAP.SingleNamespaceDeclaration, "xmlns", "demo", operationNamespace);
outputData.CreateLastChild(operationNamespace, operationName + "Result", result);
}
|
For completeness - and because I had it to hand - here is a function to create a custom soap 1.1 fault incase it is of any use to you...
Code: |
void BuildSoapFault(NBElement outputRoot, string operationName)
{
NBElement outputData = outputRoot.CreateLastChildUsingNewParser("SOAP");
outputData.CreateLastChild("Context").CreateLastChild("Namespace").CreateLastChild(SOAP.SingleNamespaceDeclaration, "xmlns", "soap-env", "http://schemas.xmlsoap.org/soap/envelope/");
NBElement fault = outputData.CreateLastChild("Body").CreateLastChild("http://schemas.xmlsoap.org/soap/envelope/", "Fault");
fault.CreateLastChild("", "faultcode", "soapenv:Receiver");
fault.CreateLastChild("", "faultactor", "CreateNode");
fault.CreateLastChild("", "faultstring", "Invalid Operation: " + operationName);
fault.CreateLastChild("detail").CreateLastChild("", "Text", "Input message not recognised");
} |
In both these examples, "SOAP" (as used in SOAP.SingleNamespaceDeclaration) is defined by this convenience statement at the top of the file:
Code: |
using SOAP = IBM.Broker.Plugin.NBParsers.SOAP; |
Kind regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|