asp.net (asmx) webservices not working in windows phone 7 - web-services

I am developing a wp7 app that consumes a simple web service written in asp.net
The web service is working fine in desktop application (written in c#) (also tested in web browser and is working fine) but it is not working in wp7.
Following is the code I am using in wp7 to call the webservice
BookService.BooklocationSoapClient client = new BookService.BooklocationSoapClient();
client.BookListCompleted += new EventHandler<BookService.BookListCompletedEventArgs>(client_BookListCompleted);
client.BookListAsync(dId);
void client_BookListCompleted(object sender, BookService.BookListCompletedEventArgs e)
{
Debug.WriteLine(e.Result);
}
and following is the exception I am getting
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.ServiceModel.FaultException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.ServiceModel.FaultException' occurred in System.ServiceModel.dll
Also, I am getting the following message
Server was unable to process request. ---> Length cannot be less than zero.
Parameter name: length

Seems like you try to call local web service on your developer machine, which not allowed by
windows phone emulator.
Try call any public web service available in internet, as example weather forecast

Related

Deserialization issue when consuming ASMX Web Service from Xamarin Android .NET6 App

Android application type: Android for .NET (net6.0-android)
Affected platform version: VS 2022 Version 17.3.0 Preview 5.0 (64 bit)
I'm upgrading an existing Xamarin Traditional (Android) application into .NET 6 but I'm running into deserialization problems. Our Android app integrates with a .NET Framework 4.8 ASMX Web Service on the backend. This has been working fine for years but doesn't work after we move to .NET 6.
I was able to create a repro project on my GitHub: https://github.com/adolfo1981/Net6AndroidWebServiceTest
Here are the details from deserialization error.
Exception:
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:HelloWorldResponse. The InnerException message was 'There was an error deserializing the object of type ServiceReference1.HelloWorldResponseBody. Unexpected end of file. Following elements are not closed: HelloWorldResult, HelloWorldResponse, Body, Envelope. Line 1, position 298.'. Please see InnerException for more details.
StackTrace:
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObject(XmlDictionaryReader reader, XmlObjectSerializer serializer) in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Dispatcher/DataContractSerializerOperationFormatter.cs:line 657
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObject(XmlDictionaryReader reader) in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Dispatcher/DataContractSerializerOperationFormatter.cs:line 652
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest) in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Dispatcher/DataContractSerializerOperationFormatter.cs:line 521
My GitHub repro repo consists of the following projects:
HelloAndroid (NET6 - .net6.0-android Target Framework Moniker)
WebServiceServer (.NET Framework 4.8)
WebServiceClient (.NET 6) --> referenced by HelloAndroid project to consume ASMX Web
Services
ClientTestConsole (NET6 Console app) - to prove that Web Service works fine directly from console app (but fails from Xamarin Android)
Steps to Reproduce
Create a Xamarin Android (NET 6) project similar to #jamesmontemagno https://github.com/jamesmontemagno/net6-mobile-samples/tree/main/HelloAndroid
Create a .NET Framework 4.8 WebServiceServer application following instructions like this: https://www.c-sharpcorner.com/article/how-to-create-a-web-service-project-in-net-using-visual-studio/
Create a .NET 6 (Class Library) WebServiceClient and add a Connected Service -> Web Service pointing to a wsdl or deployed asmx file
From Main Activity create an instance of the generated soap client and call HelloWorldAsync method:
var soapClient = new WebServiceSoapClient(WebServiceSoapClient.EndpointConfiguration.WebServiceSoap);
//Async test
var helloResponse = await soapClient.HelloWorldAsync();
Expected Result: Get string response from HelloWorldAsync() method
Actual Result: I get the deserialization issue mentioned above
I have posted this issue into Microsoft Xamarin Android GitHub but still waiting for reply: https://github.com/xamarin/xamarin-android/issues/7230
I also configured my Xamarin Android app to use Fiddler Proxy and captured Soap request and response and compared them with the request and responses from my Console App and didn't find significant differences. Those are shown in this comment: https://github.com/xamarin/xamarin-android/issues/7230#issuecomment-1207297030

AppManagementServiceApplication throws "Microsoft SharePoint is not supported in 32-bit process." when registering hosted app on site

I'm on SP 2013 enterprise single server dev machine
I have prepped SP to host a remote on prem hosted app.
I navigate to /_layouts/15/AppRegNew.aspx and enter the App Id, Secret, etc and hit create ... error ID 3 and 1309 are thrown:
ID 3 is:
WebHost failed to process a request.
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/1660113
Exception: System.ServiceModel.ServiceActivationException: The service '/9fabc3ed921a42739ebeb5576c6b4e6a/AppMng.svc' cannot be activated due to an exception during compilation. The exception message is: Microsoft SharePoint is not supported in 32-bit process. Please verify that you are running in a 64-bit executable.. ---> System.PlatformNotSupportedException: Microsoft SharePoint is not supported in 32-bit process. Please verify that you are running in a 64-bit executable.
followed by 1309:
Exception information:
Exception type: ServiceActivationException
Exception message: The requested service, 'http://servername:32843/9fabc3ed921a42739ebeb5576c6b4e6a/AppMng.svc' could not be activated.
The app management and subscription services are started and running. I have a valid trust setup.
Thoughts?
In IIS there were app pools that had enable 32-bit set to true, so I set it to false and was enable to register the app.

WebSphere 8.5 integration with spring-web 3.2.17

The context:
I am involved with porting an application from running on WebSphere 7.0 to WebSphere 8.5.5.10. The application is calling web services.
The pattern:
When the web service endpoint is called first time it works just fine.
But on the subsequent calls it fails receiving the same SOAP request.
The error:
java.lang.IllegalArgumentException: The value for the "java.lang.Object" parameter cannot be null.
org.springframework.remoting.jaxws.JaxWsSoapFaultException:
java.lang.IllegalArgumentException: The value for the "java.lang.Object" parameter cannot be null.; nested exception is javax.xml.ws.soap.SOAPFaultException: java.lang.IllegalArgumentException: The value for the "java.lang.Object" parameter cannot be null.
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.doInvoke(JaxWsPortClientInterceptor.java:503)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.invoke(JaxWsPortClientInterceptor.java:487)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
The error is inside the spring-web-3.2.17.RELEASE.jar.
Any ideas will be appreciated.
You are connecting via IHS? Maybe you have a cluster and first request is served by other WAS instance.
You might also check JDK version between WAS 7.0 and 8.5.5.10 - if both are the same like java6.
(By the way, instal Fixpack to latest 8.5.5.11)

error when invoking web services using UTL_DBWS

I followed the example in Oracle tutorial how to invoke the web service.
When I run it with
l_wsdl_url := 'http://www.oracle-base.com/webservices/server.php?wsdl';
It works fine.
However, if I create my own dynamic web application in Eclipse, and generate the SAME wsdl that oracle presents, and change the code to be:
l_wsdl_url := 'http://localhost:8080/MyProject/services/CalculatorPort?wsdl';
I get an exception:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: error.build.wsdl.model: oracle.j2
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: error.build.wsdl.model: oracle.j2
So I added to the code:
sys.utl_dbws.set_http_proxy('http://localhost:8080');
I get the following exception:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: error.build.wsdl.model: oracle.j2ORA-29532: Java call
terminated by uncaught Java exception: java.lang.IllegalAccessException:
error.build.wsdl.model: oracle.j2ee.ws.commons.tools.api.WsdlValidationExcpetion:
faultCode = PARSER_EXCEPTION error reading file at:
http://localhost:8080/MyProject/services/CalculatorPort?wsdl: http://localhost
The web services runs just fine out of PL/SQL (with soap-ui) tool.
The PL/SQL is sitting behind firewall on a different machine than my localhost application.
What's wrong in the request?
If I understood correctly, what is wrong is the fact that you are trying to call localhost in a different machine than yours. When testing on PL/SQL, please replace localhost by the ip of the machine where the web service is.

Handle WCF exceptions from webservice proxy

I have a WCF service (.NET 4) hosted in IIS. My service contract has one method with:
[FaultContract(typeof(string))]
My service implementation for that method validates input parameters and may throw an exception like this:
if (string.IsNullOrWhiteSpace(siteName)) { throw new FaultException("siteName is required."); }
The consumer program of this service is a .NET 2 console application. In this app I generated the webservice proxy by right clicking "References" and "Add web reference".
When I try to call the service method from the client app, by sending an invalid siteName, I get back a 503 Service Unavailable exception, instead of a FaultException with the custom error message.
How can I make the FaultException, with the custom error message, propagate to the client program?
UPDATE:
The exception I get in the client application is this:
System.ServiceModel.ServerTooBusyException:
The HTTP service located at
http://www.example.com/services/myservice.svc
is too busy. ---> System.Net.Web
Exception: The remote server returned
an error: (503) Server Unavailable.
at
System.Net.HttpWebRequest.GetResponse()
at
System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpCha
nnelRequest.WaitForReply(TimeSpan
timeout) --- End of inner exception
stack trace ---
The problem was being caused by a custom HTTP module in our web project. So it was not exactly a WCF problem, but a problem specific to our solution. Thanks!