Can we do a 32 bit encryption (AES256) in Mule - encryption

I have to do AES256 (32 bit key) encryption in mule. I am trying to use XML encryption available in Encryption component. Please help.
The picture for flow is attached. I am getting below error when I am using XML Encryptor.
[Fatal Error] :1:1: Content is not allowed in prolog.
ERROR 2016-11-08 16:19:37,913 [[testenc].HTTP_Listener_Configuration.worker.01]
Root Exception stack trace:
Root Exception stack trace:
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)

Exception : org.xml.sax.SAXParseException: Content is not allowed in prolog. means that your XML is either malformed or it contains white space before XML declarion in many case, check your XML first
`

Take a look at the reference guide. You can configure the encryption in the visual editor by opening the Properties window
https://docs.mulesoft.com/mule-user-guide/v/3.3/mule-message-encryption-processor

Related

Alfresco web service authentication api/dictionary

I have two separate servers for alfresco and share. I can successfully login from share to alfresco. I can also change my password too. But when opening Repository Browser page, I got
this error message.
11210005 Failed to execute script 'classpath*:alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js': 11210004 11210008 Failed to run action evaluator: 11210007 Failed processing dictionary information from Alfresco: 11210006 Unable to retrieve dictionary information from Alfresco: 500
Full stack trace is
Caused by: org.alfresco.error.AlfrescoRuntimeException: 11210008 Failed to run action evaluator: 11210007 Failed processing dictionary information from Alfresco: 11210006 Unable to retrieve dictionary information from Alfresco: 500
at org.alfresco.web.evaluator.NodeTypeEvaluator.evaluate(NodeTypeEvaluator.java:98)
at org.alfresco.web.evaluator.BaseEvaluator.evaluate(BaseEvaluator.java:131)
at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
at org.mozilla.javascript.gen.c12._c4(file:/D:/alfrescoplatform/development/apache-tomcat-share_ref/webapps/share_ref1/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js:260)
at org.mozilla.javascript.gen.c12.call(file:/D:/alfrescoplatform/development/apache-tomcat-share_ref/webapps/share_ref1/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
at org.mozilla.javascript.gen.c12._c2(file:/D:/alfrescoplatform/development/apache-tomcat-share_ref/webapps/share_ref1/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js:318)
at org.mozilla.javascript.gen.c12.call(file:/D:/alfrescoplatform/development/apache-tomcat-share_ref/webapps/share_ref1/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
at org.mozilla.javascript.gen.c12._c20(file:/D:/alfrescoplatform/development/apache-tomcat-share_ref/webapps/share_ref1/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js:838)
at org.mozilla.javascript.gen.c12.call(file:/D:/alfrescoplatform/development/apache-tomcat-share_ref/webapps/share_ref1/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js)
at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
at org.mozilla.javascript.gen.c12._c0(file:/D:/alfrescoplatform/development/apache-tomcat-share_ref/webapps/share_ref1/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js:854)
at org.mozilla.javascript.gen.c12.call(file:/D:/alfrescoplatform/development/apache-tomcat-share_ref/webapps/share_ref1/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at org.mozilla.javascript.gen.c12.call(file:/D:/alfrescoplatform/development/apache-tomcat-share_ref/webapps/share_ref1/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js)
at org.mozilla.javascript.gen.c12.exec(file:/D:/alfrescoplatform/development/apache-tomcat-share_ref/webapps/share_ref1/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js)
at org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScriptImpl(JSScriptProcessor.java:318)
... 39 more
So I trace NodeTypeEvaluator and DictionaryQuery class in deep.I found calling /api/dictionary from alfresco.
I try this. Adding
webserviceclient.properties
repository.location=http://hostname:8080/alfresco/api
in share, but no success.
In calling http://hostname:8080/alfresco/api/ shows
Axis HTTP Servlet
Hi, you have reached the AXIS HTTP Servlet. Normally you would be hitting this URL with a SOAP client rather than a browser.
In case you are interested, my AXIS transport name appears to be 'http
Let me know if you have any idea.
As accepted in the comment the answer for this question:
I run Alfresco and Share almost always on different application server, you just need to change the share-config-custom.xml and alfresco-global.properties for it. There is a How-To on the Alfresco forums. Have you followed it?

File.open file creation error

I'm trying to create a file using:
Dim stmFile As Stream = File.Open(filename, FileMode.OpenOrCreate, FileAccess.Write)
This should create a file as the file specified does not currently exist however instead it throws a server error:
Could not find a part of the path 'c:\tempemail\681968_File.doc'.
Description: An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and where
it originated in the code.
Exception Details: System.IO.DirectoryNotFoundException:
Could not find a part of the path 'c:\tempemail\681968_File.doc'.
Any advice?
Try the following
Ensure that the tempemail exists
Ensure that the application pool user has write permission to the folder.

getting HTTP Status 500 when location href or when forwarding from Servlet?

I get this error:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
root cause
java.lang.NullPointerException
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1-b24 logs.
GlassFish Server Open Source Edition 3.1-b24
when I try to forward from a jsp to another jsp or when I forward in a servlet... The thing is that Y modify some datils from my page and I want to go back to the login-page and log in again to see if the update was successful !... Any ideas on this error ?... Thankx
A NullPointerException is a rather trivial exception and has actually nothing to do with JSP/Servlets, but with basic Java in general (look, it's an exception of java.lang package, not of javax.servlet package). It just means that some object is null while your code is trying to access/invoke it using the period . operator.
Something like:
SomeObject someObject = null;
someObject.doSomething(); // NullPointerException!
The 1st line of the stacktrace tells you in detail all about the class name, method name and line number where it occurred.
Fixing it is relatively easy. Just make sure that it's not null or bypass the access altogether. You should rather concentrate on why it is null and/or why your code is trying to deal with null.

Loading Policies files from https address with flex

I'm having an epic amount of difficulty trying to get a result from a httprequest to a https address.
I'm loading a policy file from the address but I'm still getting the 2048 security error.
I load my policy file like so in my preinitilize handler.
private function preint(e:FlexEvent):void
{
Security.loadPolicyFile("https://api.soundcloud.com/crossdomain.xml");
}
My server gives me back a special token I need and then I try to make a request to the resource I need using a urlrequest and urlloader.
private function getprivatetracks():void
{
var url:String=new String("https://api.soundcloud.com/me/tracks?oauth_token=" + testapplicationparameters["oauth_token"])
var req:URLRequest=new URLRequest()
req.contentType="application/x-www-form-urlencoded"
req.method=URLRequestMethod.GET;
req.url=url;
var loader:URLLoader=new URLLoader()
loader.dataFormat=URLLoaderDataFormat.TEXT;
loader.dataFormat="text";
loader.load(req);
configureListeners(loader);
}
If I trace out the url I'm calling and paste it into a browser I can see the result fine. It's purely a flash thing.
When I run the swf in debug mode from the flex IDE the request works fine. The problem only occurs when the swf is on a server.
I've spend the best part of a day banging my head trying to figure this out.
Could somebody suggest what I might be doing wrong?
I'm guessing I'm lacking some fundamental knowledge about how flash deals with https.
EDIT 1
Error: Request for resource at https://api.soundcloud.com/me/tracks?oauth_token=0000000NBfKiNXEYG00FWTUGAy5Uw68r by requestor from http://myserver/content/flash/soundcloud/sclive.swf is denied due to lack of policy file permissions.
*** Security Sandbox Violation ***
Connection to https://api.soundcloud.com/me/tracks?oauth_token=0000000NBfKiNXEYG00FWTUGAy5Uw68r halted - not permitted from http://myserver/content/flash/soundcloud/sclive.swf
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: http://myserver/content/flash/soundcloud/sclive.swf cannot load data from https://api.soundcloud.com/me/tracks?oauth_token=0000000NBfKiNXEYG00FWTUGAy5Uw68r.
at sclive/getprivatetracks()[C:\flex_projects\sclive\src\sclive.mxml:74]
at sclive/authorize_result_handler()[C:\flex_projects\sclive\src\sclive.mxml:62]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at HTTPOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\http\HTTPService.as:763]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:263]
at mx.rpc::Responder/result()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:46]
at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:409]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
EDIT 2
I've tried catching the security error event and checking the url to make sure theres no redirects going on but the handler never gets called! I always get the unhanled exception error even though I've written a handler for it.
It is not advisable to permit HTTP content to access HTTPS content for security reasons.
So, if soundcloud wants to allow HTTP content to access its data, they should specify it in their crossdomain.xml (using the attribute secure="false" in the allow-access-from tag).
However, I've just noticed there is also a crossdomain on http :
http://api.soundcloud.com/crossdomain.xml
So I suggest you to use this URL instead of the HTTPS and it shloud work

ColdFusion call to webservice gives org.xml.sax.SAXException

We are a small team with one ASP.NET web developer and one ColdFusion developer. Neither of us knows the other's environment. I wrote an ASMX webservice using Visual Studio 2005 and a web application project in Visual Studio 2008 that successfully consumes the web service. But now we are trying to have my ColdFusion colleague consume the webservice and we are getting results we cannot interpret (except to surmise that the target webservice is not even being reached but that some "system layer" used by ColdFusion is failing.
EDIT - update: 02 June 2009:
Top most part of the error message seen by CF developer:
"Could not generate stub objects for web service invocation"
Here is the stack trace seen by the CF client:
org.xml.sax.SAXException: Fatal Error: URI=null Line=11: The element type "META" must be terminated by the matching end-tag "</META>".
at org.apache.axis.utils.XMLUtils$ParserErrorHandler.fatalError(XMLUtils.java:723)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:369)
at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:388)
at coldfusion.xml.rpc.XmlRpcServiceImpl.retrieveWSDL(XmlRpcServiceImpl.java:647)
at coldfusion.xml.rpc.XmlRpcServiceImpl.access$000(XmlRpcServiceImpl.java:51)
at coldfusion.xml.rpc.XmlRpcServiceImpl$1.run(XmlRpcServiceImpl.java:208)
at java.security.AccessController.doPrivileged(Native Method)
at coldfusion.xml.rpc.XmlRpcServiceImpl.registerWebService(XmlRpcServiceImpl.java:201)
at coldfusion.xml.rpc.XmlRpcServiceImpl.getWebService(XmlRpcServiceImpl.java:475)
at coldfusion.xml.rpc.XmlRpcServiceImpl.getWebServiceProxy(XmlRpcServiceImpl.java:430)
at coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:381)
at cfuploadfileSimple2ecfm1056043715.runPage(D:\AMTSTEST\webservice\uploadfileSimple.cfm:68)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:225)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:52)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115)
at coldfusion.CfmServlet.service(CfmServlet.java:107)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:204)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:318)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:264)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Here is the signature of the webmethod we are attempting to call:
[WebMethod]
public string UploadFileBasic(string trimURL
, byte[] incomingArray
, string FileName
, string TrimRecordTypeName)
We are quite confused about how to proceed. Tomorrow I could post the CF source code if that would be useful but from what I've seen it is very straightforward and most of the arguments in the CF invoke of the service are constants (strings) at this point in our unit testing.
Any help or suggestions of appropriate CF forums would be appreciated. Thanks.
EDIT-update 02 June 2009:
Here is the CFML code:
<!--- read test.txt file into a binary variable --->
<cffile action="readBinary" file="#FileName#" variable="objBinaryData">
<!--- convert the binary variable to Base64 --->
<cfset b64file = #toBase64(objBinaryData)#>
<!--- invoke .net web service --->
<cfinvoke webservice = "http://trim/trimbroker/fileservice.asmx?wsdl"
method = "UploadFileBasic"
returnVariable = "recordNumber">
<cfinvokeargument name="trimURL" value="trim/trimWSdev/trim.asmx" />
<cfinvokeargument name="incomingArray" value="#b64file#" />
<cfinvokeargument name="FileName" value="#form.FILENAME#" />
<cfinvokeargument name="TrimRecordTypeName" value="Document" />
</cfinvoke>
Please note we have simplified this considerably trying to get things working. Arguments 1 and 4 above are simply string constants. Argument 2 is our attempt at the byte array expected by .Net. We believe we are NOT being rejected by the .Net web service; rather, it appears from the stack trace that it is falling into the SAX exception before the message is even being sent across the network. The .Net webservice does NOT log anything to the application log or system log of the server on which it runs.
The ColdFusion release is: ColdFusion MX 7.
EDIT - 04 June 2009:
Fix for this problem emerged through another more-specialized forum:
http://forums.adobe.com/message/2009491#2009491
In short, CF MX 7 fails miserably (error msg gives no clue) when the target webservice is configured in IIS with "Integrated Windows Authentication" (our's is like that and needs to be). More research led to this:
http://blog.tagworldwide.com/?p=16
We are still chasing this and trying to get a totally workable solution. The bottom line is that the ColdFusion "administrator" must do some "special configuring" to get the "generated Java stubs" able to connect to a .Net webservice that requires Windows authentication.
The element type "META" must be
terminated by the matching end-tag
"</META>".
That error message leads me to suspect that ColdFusion is attempting to use an XML parser to parse an HTML document. If I had to guess, I'd say it's probably trying to parse the ASP.NET "yellow screen of death". I suspect a malformed request from CF is causing an error on the .NET side, and you need to check your error logs on the .NET side to get a clue as to what specifically is being objected to.
Edit: By "yellow screen of death" I was just referring to the standard ASP.NET error page, which shows the error message and a stack trace on a yellow background.
In response to your updates, I can think of a few possibilities to check:
The stack trace and the second error message you posted seems to indicate that the problem is occurring while CF is downloading and parsing the WSDL to create proxy objects, long before actually calling your method. If you paste "http://trim/trimbroker/fileservice.asmx?wsdl" into a web browser, do you get WSDL or HTML? Perhaps you get redirected to a login page or something? If you don't get the WSDL XML document in your browser, CF isn't going to be able to get it either.
Your CF code is passing a base-64 string into a parameter that expects a byte array. Is the CF webservice stack smart enough to translate base-64 strings to byte arrays? I would be surprised, but maybe. Can you create byte arrays in CF? You couldn't last time I used CF, but that was a long time ago. You could try passing objBinaryData directly into the incomingArray parameter without converting to base-64, but if that doesn't work it might be easiest to change the type of incomingArray on the .NET side to string, and call Convert.FromBase64String() inside the method.
The CFML would be handy. Also, what version of CF are you using? I know earlier versions of CF had issues if there were any overloaded methods in your web service. I am unaware if this is an issue in the latest version or not.
I got the same problem, turned out because CF service is running under Local System, didn't have access to the wsdl, so ASP.Net return unauthorize access.
Try use cfhttp to get the wsdl and see what the cfhttp.fileContent is, you might have the same problem.

Resources