Microsoft.Web.Services3.ResponseProcessingException - wse

I deployed a web service that used WSE 3.0 to a test server. I am getting the cryptic error below. Have any idea what this means and how to fix it? Thanks in advance!
Microsoft.Web.Services3.ResponseProcessingException: WSE910: An error happened during the processing of a response message, and you can find the error in the inner exception. You can also find the response message in the Response property. ---> System.Xml.XmlException: 'wsse' is an undeclared namespace. Line 1, position 97.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg, Int32 lineNo, Int32 linePos)
at System.Xml.XmlTextReaderImpl.LookupNamespace(NodeData node)
at System.Xml.XmlTextReaderImpl.ElementNamespaceLookup()
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at Microsoft.Web.Services3.Xml.XmlSkipDTDReader.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at Microsoft.Web.Services3.SoapEnvelope.Load(Stream inStream)
at Microsoft.Web.Services3.Xml.SoapEnvelopeReaderWrapper..ctor(SoapClientMessage message, String messageContentType)
--- End of inner exception stack trace ---
at Microsoft.Web.Services3.Xml.SoapEnvelopeReaderWrapper..ctor(SoapClientMessage message, String messageContentType)
at Microsoft.Web.Services3.WebServicesClientProtocol.GetReaderForMessage(SoapClientMessage message, Int32 bufferSize)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

I found a solution. Since the dll was working when I called it from a windows client but was failing when called from a web service I suspected that the problem might be permissions related. I set the web service to impersonate a user with sufficient permissions. See http://support.microsoft.com/kb/306158 for how to information. Now it works. Hope this helps someone else, Dan

System.Xml.XmlException: 'wsse' is an undeclared namespace. Line 1, position 97.
Well if this statement is true then you have the wrong namespace. Check out your solution files to make sure they're under the write ns'es.

I got the same problem and it was a problem of date time synchronization between the server and the client. After setting the same time in the client and server, the error was fixed.

Related

Actual exception is not getting logged in MVC when host in IIS

I am running one MVC application where i found one exception in specific method. I will provide here complete details about it.
I am loading some third party grid control from view. to load it i used below code:
#{Html.RenderAction("MasterGridAction", "MyController");}
Now when i access this report from development then this view load and it hits this action method where i used some piece of code there it is throwing error, To catch the error i used try catch block in the method where in catch section i used below code to throw the actual exception like below:
catch (Exception ex)
{
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(ex).Throw(); throw;
}
When exception get catched it sends this to the Application_Error method in global.asax page where i used below code to find out the actual exception like below:
void Application_Error(object sender, EventArgs e)
{
HttpServerUtility server = HttpContext.Current.Server;
if (server.GetLastError() != null)
{
Exception exception = server.GetLastError();
if (exception.GetBaseException() != null)
{
exception = exception.GetBaseException();
ExceptionType(server, exception);
}
else
{
ExceptionType(server, exception);
}
}
}
In this ExceptionType method i get the exception stack and log to the file using "Log4Net". After logging to the file i could see the exception in notepad like below:
Object reference not set to an instance of an object.
Source File: /MyController/MasterGridAction
Stack Trace:
at 3D.Controllers.MyController.MasterGridAction() in D:\MyUser\3D_MVC\Application\3D_OnlyRelease\3D\Controllers\MyController.cs:line 405
--- End of stack trace from previous location where exception was thrown ---
As we can see in above exception it is clearly shown the line number also where this exception get caught.
But once i host this application in IIS server and access the same page then i could see the logged file
There it shows exception like below:
Exception Message: Object reference not set to an instance of an object.
Stack Trace: at 3D.Controllers.MyController.MasterGridAction()
--- End of stack trace from previous location where exception was thrown ---
As you can see the logged exception of IIS server is not having much information when compare to other exception details.
Am i missing anything there to get the complete exception when host in IIS?
Please suggest.
As you can see the logged exception of IIS server is not having much information when compare to other exception details.
This could be because you don't include the PDB files in production.
It might not be a great idea to include them, since that way one can reverse engineer you app with more precision if they hack your server, but it is up to you to decide. I have seen organizations that include them in their production environments.
Try publishing and deploying on a test environment with and without the PDB files to verify this.

Exception 'System.OutOfMemoryException' was thrown

We currently have a site on IIS where the outside can go on and make payments, and the payment goes through an API to a third party and payment can be seen there. We also have a database that is on a different server than the site.
We have been getting an error "Exception of type 'System.OutOfMemoryException' was thrown" when payments try to come in and it seems to keep fixing by itself without us doing anything other than logging in to the server and sometimes restarting the server. For example, when customers try to make a transaction online, they will get this error sometimes. If they try again later, then it may go through successfully without error.
Is anyone familiar with this error and know where to look or begin?
Thank you
Exception of type 'System.OutOfMemoryException' was thrown.
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.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.Runtime.CompilerServices.RuntimeHelpers._CompileMethod(IRuntimeMethodInfo method) +0
System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType, Object target) +41
System.Linq.Expressions.Expression`1.Compile() +187
System.Data.Common.Internal.Materialization.Translator.Compile(Expression body) +154
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +76
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +211
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +35
System.Data.Common.Internal.Materialization.Translator.Compile(Type resultType, Expression body) +237
System.Data.Common.Internal.Materialization.ReplacementExpressionVisitor.Visit(Expression expression) +222
System.Linq.Expressions.EntityExpressionVisitor.VisitExpressionList(ReadOnlyCollection`1 original) +155
System.Linq.Expressions.E
This is a common error when the application does not make proper use of server resources. Search for memory leaks in the code and other bad practices that could be affecting the performance. In the mean time you could just recycle the app pool several times a day, Its better than restarting the IIS process and cause less troubles to the clients.
You can checkout this link for more info

Async exception not caught by debugger

I'm working on an MVC5 project in VS2013. I seem to be finding that most (but not all) of my exceptions are being ignored by the debugger and as a result I end up with the exception and stack trace simply being written to the browser, precluding any examination of the objects involved in the exception.
For instance - I deliberately code an exception to prove the point:
<Authorize(Roles:="IdentityAdmin")>
Public Async Function Import(model As RegisterViewModel) As Task(Of ActionResult)
Dim a As Object = "he"
Dim b As Integer = a
Clearly the last line will throw a 'type mismatch' exception which I think should result in the debugger halting execution, highlighting the error in the VS2013 UI to enable me to examine the various objects and determine the problem.
Instead I simply find myself with the browser detailing the exception and VS2013 unresponsive:
Server Error in '/' Application.
Input string was not in a correct format.
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.FormatException: Input string was not in a
correct format.
Source Error:
Line 291: If Db.Users.Find(acct.username) Is Nothing Then
Line 292: Dim a As Object = "he"
Line 293: Dim b As Integer = a
When I insert the same exception-generating code into a non-async part of the code the VS debugger does catch the exception - so I am guessing this is an issue with debugging async code. Is it really the case that the VS debugger can't catch these exceptions?
UPDATE
After further searching I came across a suggestion to disable 'Just My Code' and manually enable various types of exception. There was the expected hailstorm of First Chance Exceptions most of which I could tune out by disabling certain exceptions. But this DID 'fix' the behaviour described above. It seems that the debugger is regarding my child async threads as 'Not My Code'. Slightly baffled but I guess this could be an answer of sorts?
As per the update above, the problematic behaviour detailed in the question seems to be fixed by a combination of:
Turn off 'Just My Code' in the debugger options.
Enable certain classes of exceptions in Debug/Exceptions.. - in my case Common Language Runtime Exceptions and Managed Debugging Assistants seemed to ensure that the debugger caught all my exceptions (async or otherwise).
Disable thrown (but unremarkable) exceptions which cause most grief (wrong globalisation etc).
The last two stages were happened upon somewhat by trial and error and I suspect I should ultimately chase down most of these non-breaking exceptions when I clean the project up.
Disabling Just My Code should not make a difference in this case, enabling "Break when an exception is thrown" is what you want to make the debugger stop at the correct place.
The issue is that when you make the method Async, it runs in a background Task. The Task will catch any exceptions that occur in the code it is executing and re-throw that exception to whatever uses the result of the Task. So for example if you have the following MVC code
Async Function Index() As Task(Of ActionResult)
Dim n as Integer = Await Method1()
Return View()
End Function
Async Function Method1() As Task(Of Integer)
Dim a As Integer = 0
Dim b As Integer = 1 / b
Return b
End Function
The Task executing the code inside of Method1 will catch the exception, and throw it in Index since it is using the result of Method1, then the Task executing Index will catch that exception and re-throw it to the MVC framework code that is using the result of Index, and then the MVC framework handles the exception and displays the error page.
When Just My Code is enabled and methods are executing synchronously the debugger will stop when an exception propagates out of user code with the message that it was "user unhandled". In the case above if an exception propagates from Index to the MVC framework which is not your code, the debugger will stop when JMC is enabled. Since in the case of an asynchronous method the exception is not unhandled but caught by the Task, it does not cross out of user code so disabling Just My code will not make a difference.
The reverse of this is, if an exception occurs in your synchronous method and you have disabled Just My Code, the debugger would not stop anyway, because there is no notion of "User Unhandled" when JMC is disabled and the MVC framework will ultimately handle that exception.

nullPointerException while linking jsp file to mysql

HTTP Status 500 - Internal Server Error
type Exception report
messageInternal Server Error
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 4.0 logs.
GlassFish Server Open Source Edition 4.0
I'm not able to open the stack trace. the log file under domain is empty. pls help
NullPointerException means you are trying to call a non-static method (or an attribute) of an object which is not defined.
Example:
String s = "Foo";
System.out.println(s.length());
This code prints 3, because the length of Foo is 3, and s has been initialized as Foo.
Example with NullPointerException:
String s = null;
System.out.println(s.length());
Here s is null and I try to call the method length(), which is a non-static method. Obviously I will get a NullPointerException: there is no sense to get the length of "nothing" (null).
Nevertheless, you still can call static methods with s:
String s = null;
System.out.println(s.valueOf('a'));
Prints a. Note that it is not a good way to call static methods.
The static method valueOf(char) from the type String should be accessed in a static way
This warning explains you should access valueOf(char) this way:
System.out.println(String.valueOf('a'));
Now I let you find the error in your code because you didn't share it.

How to return stack Trace to Client in MULE..?

Does anybody know how to print full stack trace on the Browser, when a Runtime Exception occurs in MULE..??
When a runtime Exception occurs, MULE throws a 500 Server Error to the client , but shows no details to the client. It prints the whole stack trace in Console or Log Files (like the following) :
Root Exception stack trace:
java.sql.SQLException: Invalid column name
at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3677)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:2749)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:494)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true'
for everything)
Can i show the same stack Trace on the Browser (to the client)..??
And if possible , then also tell me how to switch ON or OFF printing of Stack Trace on Browser..??
(It may be possible that sometime in future , i dont want to show stack trace on browser)
Yes this is possible. I assume you are using a regular HTTP endpoint and this is a REST type service(?) If so, you can simply put a try/catch around the code causing the exception and return whatever text you want.
There are also exception strategies (http://www.mulesoft.org/documentation/display/MULE3USER/Error+Handling) for doing more sophisticated error handling, but it sounds like you are looking for the simple answer above.
If this doesn't answer your question, please provide more info about your mule config and the service that is raising the exception.
There is nothing out of the box in Mule to do that. You have to implement an exception handler that will format the stacktrace in the Message exception payload and return it to the caller.
In your case, the HTTP transport has a particularity that can be found in the HttpMessageReceiver code:
try
{
conn.writeResponse(processRequest(request));
}
catch (Exception e)
{
...
conn.writeResponse(buildFailureResponse(request.getRequestLine().getHttpVersion(), httpStatus, e.getMessage()));
This means that when an exception crops-up to the top level, the creation of the failure message response is not customizable: you get this pretty technical message back and that is all.
I see two options to solve your problem:
sub-class HttpMessageReceiver and make the response message customizable in your version,
drop the HTTP transport in favor of the Jetty one (look at the bookstore example) and customize the response error messages at the web container level.