Can CF10 handle createobject/webservice calls directly to a CXF based webservice?
there number of blog discussions out there show workarounds calling cxf webservices using createobject/java, cfinvoke, etc.these methods require write out actual soap request, or create , use java objects. can cf10 handle cxf based webservices more directly? there argument can set in createobject or cfobject call this?
some blog links on subject:
http://onlineanthony.blogspot.com/2010/05/using-ws-security-for-soap-in.html
http://tjordahl.blogspot.com/2009/04/make-coldfusion-8-work-with-apache-cxf.html
i able work through on own. (a bit more work necessary since many of coldfusion documentation's soap examples broken.) code creates xml structure matches wsse:security request header. got header info sniffing webservice call made java application. here code:
<cfscript>
wsobj = createobject("webservice", "http://gall.blackbean.com/protex-sdk/v6_1/user?wsdl");
// create ws security header cfml xml object.
doc = xmlnew();
doc.xmlroot = xmlelemnew(doc, "wsse:security");
xmlattrib1struct["xmlns:wsse"] = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
doc.xmlroot.xmlattributes = xmlattrib1struct;
// create wsse:usernametoken
doc.xmlroot.xmlchildren[1] = xmlelemnew(doc, "wsse:usernametoken");
usernametokenattribstruct["wsu:id"] = "usernametoken-24";
usernametokenattribstruct["xmlns:wsse"] = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
usernametokenattribstruct["xmlns:wsu"] = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
doc.xmlroot["wsse:usernametoken"].xmlattributes = usernametokenattribstruct;
// create wsse:username , add usernametoken
doc.xmlroot["wsse:usernametoken"].xmlchildren[1] = xmlelemnew(doc, "wsse:username");
doc.xmlroot["wsse:usernametoken"]["wsse:username"].xmltext = "smith@blackbean.com";
structdelete(doc.xmlroot["wsse:usernametoken"]["wsse:username"], "xmlattributes");
// create wsse:password_text , add usernametoken
doc.xmlroot["wsse:usernametoken"].xmlchildren[2] = xmlelemnew(doc, "wsse:password");
doc.xmlroot["wsse:usernametoken"]["wsse:password"].xmltext = "beans";
passwordattribstruct["type"] = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0" & chr(35) & "passwordtext";
doc.xmlroot["wsse:usernametoken"]["wsse:password"].xmlattributes = passwordattribstruct;
//writedump(doc);
addsoaprequestheader(wsobj, "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "wsse:security", doc);
ret = wsobj.getuserbyemail("smith@blackbean.com");
</cfscript>
<cfoutput>
user's firstname: #ret.getfirstname()#<br/>
user's lastname: #ret.getlastname()#<br/>
user's email: #ret.getemail()#\
</cfoutput>
More discussions in ColdFusion
adobe
Comments
Post a Comment