473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem calling C# web service with Ref parameter from a VB.NET Web application

Hello,

I have an asp.net Web app in vb.net trying to call a C# web service
which takes a reference parameter. I tried a simple C# web app to call
the Web service and it works perfectly. However, when I try it in the
vb.net web app, I run into XML definition errors. Looks like the proxy
class is not able to generate the correct XML with the ref parameter.
Here is error:

The element 'urn:test-com:document:test:rfc:functions:T_RETURN has
invalid child element 'urn:test-com:document:test:rfc:functions:item'.
Expected 'urn:test-com:document:test:rfc:functions:ITEM_NUMBER
urn:test-com:document:test:rfc:functions:PO_ITEM_NO

Here is how I am declaring the ref parameter in vb.net

Dim oReturnObj(0) as com.abc.qa.ZRETURNOBJ
oReturnObj(0) = New com.abc.qa.ZRETURNOBJ

Any help will be great.

-PCP

Dec 4 '05 #1
3 4053
I know this doesn't really answer your question, but the advice might
help you more than a direct answer: don't use a ref parameter on a web
service method.

It doesn't make sense. Web services are a cross-process (usually
cross-machine) communication mechanism. The ref keyword is used to allow
the client to change the object reference that a variable points to.
There is no way that your server side code (web service method) will be
able to change the reference to the variable in the client code.

Perhaps you can explain what you were trying to accomplish with the ref
parameter, and we can suggest a better alternative?
Or, if the ref parameter is required by other (non web service) clients
of the method, you might want to make a "wrapper" method without any ref
parameters that is exposed as a web service, and it just calls your
other method internally.

Joshua Flanagan
http://flimflan.com/blog

Pratcp wrote:
Hello,

I have an asp.net Web app in vb.net trying to call a C# web service
which takes a reference parameter. I tried a simple C# web app to call
the Web service and it works perfectly. However, when I try it in the
vb.net web app, I run into XML definition errors. Looks like the proxy
class is not able to generate the correct XML with the ref parameter.
Here is error:

The element 'urn:test-com:document:test:rfc:functions:T_RETURN has
invalid child element 'urn:test-com:document:test:rfc:functions:item'.
Expected 'urn:test-com:document:test:rfc:functions:ITEM_NUMBER
urn:test-com:document:test:rfc:functions:PO_ITEM_NO

Here is how I am declaring the ref parameter in vb.net

Dim oReturnObj(0) as com.abc.qa.ZRETURNOBJ
oReturnObj(0) = New com.abc.qa.ZRETURNOBJ

Any help will be great.

-PCP

Dec 6 '05 #2
I second that. This feels weird for something that should really
follow the tennets of service orientation.

Web services should be used in a stateless "service" manner. That is,
it should sit there and take requests and (optionall!) give responses.
You sent it a message, it MAY send a message back. Anything other than
that is kinda weird and violates the Don Box laws. (google 'em)

Dec 7 '05 #3
Hi Joshua,

Thanks for your response. The Web service itself is being provided by
an external client of ours. We are just making calls from our asp.net
web application to create orders through the external client's Web
service. If I had a choice of creating the Web service, I would agree
that ref parameters is not a good SOA practice. Also, the ref parameter
object does not help us with anything. The Web service fills the order
details with tracking ID etc in the ref parameter object - However, I
can get this from the return object as well!!!!

So, in order to get this working, I had to create a C# class library
within my asp.net solution and add a reference to this library from my
Web application. This resolved the issue with malformed XML for the ref
parameter.

I would still like to know why ref parameters work fine in C# and not
in VB.Net. Is it because:
- I am declaring and using this object in an inconsistent manner or
- is it because C# as a language has greater support compared to vb.net
or
- Should I be tweaking the Proxy class to make sure the parameters get
sent out as ByRef since the default vb.bet implementation is ByVal???

Any further insights will be great!

- PCP

Dec 7 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
5
by: James Wong | last post by:
Dear all, I've a web service function and it contains a parameter in System.Text.Encoding. I found that the data type of this parameter in caller application becomes MyWebSvcName.Encoding...
4
by: JLJ | last post by:
I have a very simple webservice written in Java/Axis. It takes in a complexType with 2 string elements, userid and password. The response is a complexType containing two complexTypes each having...
7
by: Christian Wilhelm | last post by:
Hi! I'm trying to call a Java WebService out of a .net Client. There are two Methods, one Method requires one Parameter of type Parameter, the other Method requires one Parameter of type...
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
12
by: scottt | last post by:
hi, I am having a little problem passing in reference of my calling class (in my ..exe)into a DLL. Both programs are C# and what I am trying to do is pass a reference to my one class into a DLL...
2
by: Polaris431 | last post by:
I have an ASP.NET website that includes a web service in my project as well. The web service is a class within my website and not a separate project. I am trying to call a method in my web...
1
by: vanajasethu | last post by:
Hi all, I am working in dotnet remoting using dotnet framework 2.0 in windows xp. I am hosting the remote object in iis using http channel and binary formatter and registering the object in...
8
by: Chizl | last post by:
I'm building a web server and having some issues with the TCPListener.Start(BackLog). It doesn't seem to do as expected. I'm using MS Web Stress Tool to test against my web server and when I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.