Author |
Message
|
mehdiK |
Posted: Tue Mar 19, 2013 7:35 am Post subject: HTTPRequest Basic authentication failed |
|
|
Acolyte
Joined: 07 Mar 2013 Posts: 53
|
Hello,
I'm using WMB8 and I have an HTTPRequest node.
I have to set the username and password because the external webservice needs authentication. I've read in many topics about the basic authentication and its what I try to do.
I've added an HTTHeader node before the HTTPRequest node, so my flow became like this :
HTTPInput --> JavaCompute --> HTTPHeader --> HTTPRequest --> HTTPReply
I've also added the following header in the HTTP Header Node :
Name: Proxy-Authorization
Type : Value
Value : Basic <<My credentials converted to base64 encode>>
as mentionned to this solved topic : http://www.mqseries.net/phpBB2/viewtopic.php?p=332015&sid=9b825a3e642e66f0bfb7c83c587e10e6
but still doesn't work.
Please do you have any issue about this ? |
|
Back to top |
|
 |
whiting |
Posted: Tue Mar 19, 2013 7:48 am Post subject: More information please |
|
|
Acolyte
Joined: 26 Mar 2002 Posts: 64 Location: Greenville, SC
|
What doesn't work?
What is the exception that is thrown in the message flow.
Does the web server log show that the username/password failed, or that there was none?
//Bill |
|
Back to top |
|
 |
mehdiK |
Posted: Tue Mar 19, 2013 7:55 am Post subject: |
|
|
Acolyte
Joined: 07 Mar 2013 Posts: 53
|
I'm trying to send an xml file to IBM forms so it displays : No submissions.
and I get the exception : BIP3313e and BIP2230e and BIP4394e
p.s : I send the xml file via curl |
|
Back to top |
|
 |
McueMart |
Posted: Tue Mar 19, 2013 7:56 am Post subject: |
|
|
 Chevalier
Joined: 29 Nov 2011 Posts: 490 Location: UK...somewhere
|
Add a trace node and trace
Code: |
${Root}
------------
${LocalEnvironment}
|
before the HTTPRequest node and post the data here. |
|
Back to top |
|
 |
mehdiK |
Posted: Tue Mar 19, 2013 8:02 am Post subject: |
|
|
Acolyte
Joined: 07 Mar 2013 Posts: 53
|
Thank you.
with adding a trace before HTTPRequest :
it gives me :
Code: |
( ['WSRoot' : 0x12528b50]
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0xf74c4a0]
(0x03000000:PCDataField):feed = NULL
(
(0x03000100:Attribute ):xmlns = 'http://www.w3.org/2005/Atom' (CHARACTER)
(0x03000000:PCDataField):entry = NULL
(
(0x03000000:PCDataField):title = 'F_Form1' (CHARACTER)
(
(0x03000100:Attribute):type = 'text' (CHARACTER)
)
(0x03000000:PCDataField):updated = '1970-01-01T00:00:00Z' (CHARACTER)
(0x03000000:PCDataField):content = NULL
(
(0x03000100:Attribute ):type = 'application/xml' (CHARACTER)
(0x03000000:PCDataField):F_Form1 = NULL
(
(0x03000100:Attribute ):xmlns = '' (CHARACTER)
(0x03000100:Attribute ):application_uid = '20864346-99e9-48e1-8023-3e5625323e7c' (CHARACTER)
(0x03000100:Attribute ):pressedButton = 'S_Submit' (CHARACTER)
(0x03000100:Attribute ):flowState = 'ST_Start' (CHARACTER)
(0x03000000:PCDataField):F_RegleA = 'TestA' (CHARACTER)
)
)
)
)
)
(0x01000000:Name ):HTTPRequestHeader = ( ['WSREQHDR' : 0xf87dad0]
(0x03000000:NameValue):Proxy-Authorization = 'Basic aHR0cDovLzE5Mi4xNjguMS4yNDg6MTAwMzkvZm9ybXMtYmFzaWMvc2VjdXJlL29yZy9kYXRhLzIwODY0MzQ2LTk5ZTktNDhlMS04MDIzLTNlNTYyNTMyM2U3Yy9GX0Zvcm0xL3dwYWRtaW46cGFzc3cwcmQ=' (CHARACTER)
)
)
|
and with
Code: |
${LocalEnvironment} |
it gives me :
Code: |
( ['MQROOT' : 0xb486760]
(0x01000000:Name):Destination = (
(0x01000000:Name):HTTP = (
(0x03000000:NameValue):RequestIdentifier = X'414d51204d42514d47522020202020205b34475120004a0c' (BLOB)
)
)
)
|
|
|
Back to top |
|
 |
Esa |
Posted: Tue Mar 19, 2013 8:05 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
I think the HTTPRequestHeader should be placed before XMLNSC.
But would HttpHEader node put it in a wrong place?
Broker version? |
|
Back to top |
|
 |
Esa |
Posted: Tue Mar 19, 2013 8:12 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
And Root.Properties is missing, too. Did your java code fail to copy it? |
|
Back to top |
|
 |
mehdiK |
Posted: Tue Mar 19, 2013 8:20 am Post subject: |
|
|
Acolyte
Joined: 07 Mar 2013 Posts: 53
|
Thank you for reply.
Quote: |
I think the HTTPRequestHeader should be placed before XMLNSC.
But would HttpHEader node put it in a wrong place? |
Why do I have to put it before the JavaCompute ?
Quote: |
Did your java code fail to copy it? |
I don't copy the xml input file, I get field by field and create a new one with the same architecture. I don't think that it copies something. |
|
Back to top |
|
 |
Esa |
Posted: Tue Mar 19, 2013 9:10 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
How did you create the JCN java code? If you used the wizard did you select "Modifying message class" ori "Creating message class"?
If "Modifying message class", is this line still present in your code:
Code: |
MbMessage outMessage = new MbMessage(inMessage); |
If "Creating message class", is this line still present in your code:
Code: |
copyMessageHeaders(inMessage, outMessage); |
|
|
Back to top |
|
 |
mehdiK |
Posted: Tue Mar 19, 2013 9:15 am Post subject: |
|
|
Acolyte
Joined: 07 Mar 2013 Posts: 53
|
Thank you.
I selected : "Creating message class"
and I don't have the
Code: |
copyMessageHeaders(inMessage, outMessage); |
do I have to copy it and why ?
Thank you |
|
Back to top |
|
 |
mehdiK |
Posted: Tue Mar 19, 2013 9:35 am Post subject: |
|
|
Acolyte
Joined: 07 Mar 2013 Posts: 53
|
I've juste wrote back the copymessage java function and added it's call (I didn't understand why did I have to do it) and here's the trace result :
Code: |
( ['WSRoot' : 0x125291b0]
(0x01000000:Name ):Properties = ( ['WSPROPERTYPARSER' : 0x12469730]
(0x03000000:NameValue):MessageSet = '' (CHARACTER)
(0x03000000:NameValue):MessageType = '' (CHARACTER)
(0x03000000:NameValue):MessageFormat = '' (CHARACTER)
(0x03000000:NameValue):Encoding = 546 (INTEGER)
(0x03000000:NameValue):CodedCharSetId = 1208 (INTEGER)
(0x03000000:NameValue):Transactional = FALSE (BOOLEAN)
(0x03000000:NameValue):Persistence = FALSE (BOOLEAN)
(0x03000000:NameValue):CreationTime = GMTTIMESTAMP '2013-03-19 17:32:47.799999' (GMTTIMESTAMP)
(0x03000000:NameValue):ExpirationTime = -1 (INTEGER)
(0x03000000:NameValue):Priority = 0 (INTEGER)
(0x03000000:NameValue):ReplyIdentifier = X'000000000000000000000000000000000000000000000000' (BLOB)
(0x03000000:NameValue):ReplyProtocol = 'SOAP-HTTP' (CHARACTER)
(0x03000000:NameValue):Topic = NULL
(0x03000000:NameValue):ContentType = 'text/xml' (CHARACTER)
(0x03000000:NameValue):IdentitySourceType = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourceToken = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourcePassword = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourceIssuedBy = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedType = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedToken = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedPassword = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedIssuedBy = '' (CHARACTER)
)
(0x01000000:Name ):HTTPRequestHeader = ( ['WSREQHDR' : 0xf793e30]
(0x03000000:NameValue):Proxy-Authorization = 'Basic aHR0cDovLzE5Mi4xNjguMS4yNDg6MTAwMzkvZm9ybXMtYmFzaWMvc2VjdXJlL29yZy9kYXRhLzIwODY0MzQ2LTk5ZTktNDhlMS04MDIzLTNlNTYyNTMyM2U3Yy9GX0Zvcm0xL3dwYWRtaW46cGFzc3cwcmQ=' (CHARACTER)
)
(0x01000000:Name ):HTTPInputHeader = ( ['WSINPHDR' : 0x125294e0]
(0x03000000:NameValue):X-Original-HTTP-Command = 'POST http://192.168.1.246:7080/FormTeleService HTTP/1.1' (CHARACTER)
(0x03000000:NameValue):User-Agent = 'curl/7.26.0' (CHARACTER)
(0x03000000:NameValue):Host = '192.168.1.246:7080' (CHARACTER)
(0x03000000:NameValue):Accept = '*/*' (CHARACTER)
(0x03000000:NameValue):Content-Type = 'text/xml' (CHARACTER)
(0x03000000:NameValue):Content-Length = '423' (CHARACTER)
(0x03000000:NameValue):X-Remote-Addr = '192.168.1.246' (CHARACTER)
(0x03000000:NameValue):X-Remote-Host = '192.168.1.246' (CHARACTER)
(0x03000000:NameValue):X-Server-Name = '192.168.1.246' (CHARACTER)
(0x03000000:NameValue):X-Server-Port = '7080' (CHARACTER)
(0x03000000:NameValue):X-Scheme = 'http' (CHARACTER)
)
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0xf74b000]
(0x03000000:PCDataField):feed = NULL
(
(0x03000100:Attribute ):xmlns = 'http://www.w3.org/2005/Atom' (CHARACTER)
(0x03000000:PCDataField):entry = NULL
(
(0x03000000:PCDataField):title = 'F_Form1' (CHARACTER)
(
(0x03000100:Attribute):type = 'text' (CHARACTER)
)
(0x03000000:PCDataField):updated = '1970-01-01T00:00:00Z' (CHARACTER)
(0x03000000:PCDataField):content = NULL
(
(0x03000100:Attribute ):type = 'application/xml' (CHARACTER)
(0x03000000:PCDataField):F_Form1 = NULL
(
(0x03000100:Attribute ):xmlns = '' (CHARACTER)
(0x03000100:Attribute ):application_uid = '20864346-99e9-48e1-8023-3e5625323e7c' (CHARACTER)
(0x03000100:Attribute ):pressedButton = 'S_Submit' (CHARACTER)
(0x03000100:Attribute ):flowState = 'ST_Start' (CHARACTER)
(0x03000000:PCDataField):F_RegleA = 'TestA' (CHARACTER)
)
)
)
)
)
)
|
|
|
Back to top |
|
 |
marko.pitkanen |
Posted: Tue Mar 19, 2013 11:34 am Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Are you using http -proxy between the flow and the application you are invoking? If not I think your httpRequestHeader need different attribute.
And perhaps the correct way with broker is to use security profiles to propagate identity and security tokens with the request.
--
Marko |
|
Back to top |
|
 |
mehdiK |
Posted: Wed Mar 20, 2013 2:40 am Post subject: |
|
|
Acolyte
Joined: 07 Mar 2013 Posts: 53
|
Thanks Marco.
No I'm not using a proxy, all what I want is an HTTP authentication to the service which I want to send a request.
So, I have to use the SecurityPEP node right ? |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Mar 20, 2013 4:03 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
mehdiK wrote: |
Thanks Marco.
No I'm not using a proxy, all what I want is an HTTP authentication to the service which I want to send a request. |
Have you considered setting Identity.SourceUser and using default propagation instead of buliding your own code?
mehdiK wrote: |
So, I have to use the SecurityPEP node right ? |
NO. |
|
Back to top |
|
 |
mehdiK |
Posted: Wed Mar 20, 2013 4:24 am Post subject: |
|
|
Acolyte
Joined: 07 Mar 2013 Posts: 53
|
Thank you.
I've removed the httpHeader node and added a Compute Node before the HttpRequest node,
I've added on it :
Code: |
SET OutputRoot.Properties.IdentityMappedType = 'usernameAndPassword';
SET OutputRoot.Properties.IdentityMappedToken = 'wpadmin';
SET OutputRoot.Properties.IdentityMappedPassword = 'passw0rd';
|
I tried the default propagation, and mapped the identity in a Compute node.
I've also modified the security settings of the HTTPInput which provides the external service wich need authentication and set the identity token type to username+password, and the credantials to the 2 other fields. But still don't work.
Is what I did what you meant ?
Thank you. |
|
Back to top |
|
 |
|