View Full Version : Exporting (out) and (object) parameters
djeeg
08-12-2006, 02:13 AM
Hi
I am trying to export an interface that has a method with out and object parameters, but when i view the asmx in the webbrowser i do not get the fields to enter data so i don't know if i am doing something wrong.
public interface ISpringMembershipProviderAuthServer {
MembershipUser CreateUser(string name, string password, string email, string question, string answer, bool isapproved, object userid, out MembershipCreateStatus status);
MembershipUser CreateUser1(string name, string password, string email, string question, string answer, bool isapproved);
}
For CreateUser1 i get the fields but for CreateUser i don't get any.
Then on the client, when i use the exported WebServiceClientFactory the browser kicks we too a cannot connect page when i use CreateUser but CreateUser1 is okay. I have looked at the VS2005 web reference when i add it manually, and it does get the status and object. So could it be a problem with the client rather than the server. The code of the VS generated webreference is this:
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.org/CreateUser", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse .Literal, ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
public MembershipUser CreateUser(string name, string password, string email, string question, string answer, bool isapproved, object userid, out MembershipCreateStatus status) {
object[] results = this.Invoke("CreateUser", new object[] {
name,
password,
email,
question,
answer,
isapproved,
userid});
status = ((MembershipCreateStatus)(results[1]));
return ((MembershipUser)(results[0]));
}
djeeg
08-12-2006, 03:38 AM
In further investigation i tried debugging this in IE instead of firefox and the connection reset was really an exception of this type:
System.ExecutionEngineException in Unknown Module
now a bit of google investigation seems to suggest that this is a marshaling issue. having a look at the vs web reference code again, i see that the objects get a proxy type that have the same properties. is there anyway to convert the object over the webservice into the type from the interface?
More investigation i have created the webservice the standard asp.net 2.0 way and things work as expected. That is i have an asmx file with codebehind on the server and the web reference from the wsdl on the client. And having convert functions to the right object type.
What i did next was to leave the server as a System.Web.Services.WebService and changed the client to use WebServiceProxyFactory. Unfortunately i can then not use the same interface for the service as i use on the server as the wsdl->code generator creates duplicate classes with the same properties. They look the same as the ones on the server but they aren't. Finally in the client once i make the call to the webservice i have to convert all the objects from the wsdl ones to my domain model.
It looks like i can only use the same ServiceInterface on the Spring.Web.Services.WebService*Factory as i do on the the server, if i am passing primatives and expecting one return value that is also a primative.
spmva
08-14-2006, 12:15 PM
I think you've answered your own question. I don't know if this was the major part of your issue or not, but the part that stuck out for me was:
"Finally in the client once i make the call to the webservice i have to convert all the objects from the wsdl ones to my domain model. "
If you look in this forum group long enough you'll see a number of discussions centered on this very topic. The most recent one:
http://forum.springframework.net/showthread.php?t=329
has proven to be the most interesting with potential solution for the problem. As you can read from my last post to the thread a few weeks ago, I felt as though I'd proven the solution's worth in my own implementation (outside of spring with a low degree of abstraction, unfortunately) which seemed to work quite well.
In any case the poll associated with the thread seems to show the level of non-interest in the topic by the community.
Perhaps someone from the Spring development team could chime in on this one. Has any additional thought been given to this issue?
Anyone tired of me lobbying on this one yet? :-)
Best regards,
Stephen
Bruno Baia
08-19-2006, 04:22 PM
Hi,
I am trying to export an interface that has a method with out and object parameters, but when i view the asmx in the webbrowser i do not get the fields to enter data so i don't know if i am doing something wrong.
When using the asmx page, you can get fields to enter data only if the type is a simple type from the .NET framework like a string, an int or datetime.
In your case you can't get a field for your domain object "MembershipCreateStatus".
About the domain object problem, one thing you can do is to use a code first approach if you control both client and server : create a library with your interfaces and the related domain objects and use it on both client and server.
To spmva,
We really have interest on this, but we are focusing on Spring.Web and Spring.Data to release the 1.1 Preview 3.
-Bruno
djeeg
08-20-2006, 07:23 AM
Hi Bruno,
Yes i am trying to do the method you suggested as i control the server and the client. So you would suggest that i use the wsdl exporter tool in vs2005, then replace all the generated types with the domain objects from the shared assembly. I have read that i must be careful not to re-generate the client, otherwise i will lose my changes. But there are was around this.
spmva
08-21-2006, 12:01 PM
Bruno,
Thanks for your reply. I had a feeling the attention was focused elsewhere for the moment. I'm happy to hear that there is still interest.
Best regards,
Steve
Bruno Baia
08-26-2006, 06:18 PM
Hi,
So you would suggest that i use the wsdl exporter tool in vs2005, then replace all the generated types with the domain objects from the shared assembly. I have read that i must be careful not to re-generate the client, otherwise i will lose my changes. But there are was around this.
If you are using the latest nightly build, you can use the WebServiceClientFactory that does not need the wsdl tool, it generates the proxy dynamically with an url and the interface type.
Take a look to the calculator sample for an example.
You can find another example on the forum question page (http://opensource.atlassian.com/confluence/spring/display/NET/Forum+Questions) in the Wiki ("Post 413 & 518 - Sample POC WSE2 Integration")
-Bruno
djeeg
08-27-2006, 01:48 PM
Thanks Bruno, the WebServiceClientFactory is awesome, and i like the fact i write the interface and all the methods and client are exposed automatically. Great work. What i might do is instead of returning complex types is just to make all my webservices only expose simple types. This way at least i wont have to use the cumbersome wsdl exporter at all. Then in the future if the xslt translations get implemented, i can convert (but only if i need to).
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.