473,287 Members | 1,868 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,287 software developers and data experts.

Webservice trouble!


Hello,
I need to call a webservice with an
System.Xml.XmlDocument objet and read the return value into and

System.Xml.XmlDocument. The webservice was written with an oracle tool and
wrapped into a .net webservice.

I have added a reference to my dotnet wrapper and i get the following
refrence file:
using System.Diagnostics;

using System.Web.Services;

using System.ComponentModel;

using System.Web.Services.Protocols;

using System;

using System.Xml.Serialization;

/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Web.Services",
"2.0.50727.42")]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("c ode")]

[System.Web.Services.WebServiceBindingAttribute(Nam e="ServiceSoap",
Namespace="http://tempuri.org/")]

public partial class Service :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {
private System.Threading.SendOrPostCallback
processMessageOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <remarks/>

public Service() {

this.Url =
global::testMyWebService.Properties.Settings.Defau lt.testMyWebService_localhost_Service;

if ((this.IsLocalFileSystemWebService(this.Url) == true)) {

this.UseDefaultCredentials = true;

this.useDefaultCredentialsSetExplicitly = false;

}

else {

this.useDefaultCredentialsSetExplicitly = true;

}

}
public new string Url {

get {

return base.Url;

}

set {

if ((((this.IsLocalFileSystemWebService(base.Url) == true)

&& (this.useDefaultCredentialsSetExplicitly == false))

&& (this.IsLocalFileSystemWebService(value) == false))) {

base.UseDefaultCredentials = false;

}

base.Url = value;

}

}
public new bool UseDefaultCredentials {

get {

return base.UseDefaultCredentials;

}

set {

base.UseDefaultCredentials = value;

this.useDefaultCredentialsSetExplicitly = true;

}

}
/// <remarks/>

public event processMessageCompletedEventHandler processMessageCompleted;
/// <remarks/>

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.org/processMessage",
RequestNamespace="http://tempuri.org/",
ResponseNamespace="http://tempuri.org/",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]

public System.Xml.XmlNode processMessage(System.Xml.XmlNode mes) {

object[] results = this.Invoke("processMessage", new object[] {

mes});

return ((System.Xml.XmlNode)(results[0]));

}
/// <remarks/>

public void processMessageAsync(System.Xml.XmlNode mes) {

this.processMessageAsync(mes, null);

}
/// <remarks/>

public void processMessageAsync(System.Xml.XmlNode mes, object userState) {

if ((this.processMessageOperationCompleted == null)) {

this.processMessageOperationCompleted = new
System.Threading.SendOrPostCallback(this.Onprocess MessageOperationCompleted);

}

this.InvokeAsync("processMessage", new object[] {

mes}, this.processMessageOperationCompleted, userState);

}
private void OnprocessMessageOperationCompleted(object arg) {

if ((this.processMessageCompleted != null)) {

System.Web.Services.Protocols.InvokeCompletedEvent Args invokeArgs =
((System.Web.Services.Protocols.InvokeCompletedEve ntArgs)(arg));

this.processMessageCompleted(this, new
processMessageCompletedEventArgs(invokeArgs.Result s, invokeArgs.Error,
invokeArgs.Cancelled, invokeArgs.UserState));

}

}
/// <remarks/>

public new void CancelAsync(object userState) {

base.CancelAsync(userState);

}
private bool IsLocalFileSystemWebService(string url) {

if (((url == null)

|| (url == string.Empty))) {

return false;

}

System.Uri wsUri = new System.Uri(url);

if (((wsUri.Port >= 1024)

&& (string.Compare(wsUri.Host, "localHost",
System.StringComparison.OrdinalIgnoreCase) == 0))) {

return true;

}

return false;

}

}
/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Web.Services",
"2.0.50727.42")]

public delegate void processMessageCompletedEventHandler(object sender,
processMessageCompletedEventArgs e);
/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Web.Services",
"2.0.50727.42")]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("c ode")]

public partial class processMessageCompletedEventArgs :
System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal processMessageCompletedEventArgs(object[] results, System.Exception
exception, bool cancelled, object userState) :

base(exception, cancelled, userState) {

this.results = results;

}
/// <remarks/>

public System.Xml.XmlNode Result {

get {

this.RaiseExceptionIfNecessary();

return ((System.Xml.XmlNode)(this.results[0]));

}

}

}

}

How can i call this webservice with an

System.Xml.XmlDocument

and read the result with

System.Xml.XmlDocument

?

I'm using visual studio 2005.

Many thanks in advance

JJ
Feb 15 '06 #1
4 6218
JJ,
I have noticed that attempting to return an XmlDocument from an ASP.NET
Webservice usually results in getting an XmlNode. So you can try getting the
result of the WebService Call as XmlNode, and if you really require a
complete XmlDocument, just add the Node to a new instance of XmlDocument.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"jens Jensen" wrote:

Hello,
I need to call a webservice with an
System.Xml.XmlDocument objet and read the return value into and

System.Xml.XmlDocument. The webservice was written with an oracle tool and
wrapped into a .net webservice.

I have added a reference to my dotnet wrapper and i get the following
refrence file:
using System.Diagnostics;

using System.Web.Services;

using System.ComponentModel;

using System.Web.Services.Protocols;

using System;

using System.Xml.Serialization;

/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Web.Services",
"2.0.50727.42")]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("c ode")]

[System.Web.Services.WebServiceBindingAttribute(Nam e="ServiceSoap",
Namespace="http://tempuri.org/")]

public partial class Service :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {
private System.Threading.SendOrPostCallback
processMessageOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <remarks/>

public Service() {

this.Url =
global::testMyWebService.Properties.Settings.Defau lt.testMyWebService_localhost_Service;

if ((this.IsLocalFileSystemWebService(this.Url) == true)) {

this.UseDefaultCredentials = true;

this.useDefaultCredentialsSetExplicitly = false;

}

else {

this.useDefaultCredentialsSetExplicitly = true;

}

}
public new string Url {

get {

return base.Url;

}

set {

if ((((this.IsLocalFileSystemWebService(base.Url) == true)

&& (this.useDefaultCredentialsSetExplicitly == false))

&& (this.IsLocalFileSystemWebService(value) == false))) {

base.UseDefaultCredentials = false;

}

base.Url = value;

}

}
public new bool UseDefaultCredentials {

get {

return base.UseDefaultCredentials;

}

set {

base.UseDefaultCredentials = value;

this.useDefaultCredentialsSetExplicitly = true;

}

}
/// <remarks/>

public event processMessageCompletedEventHandler processMessageCompleted;
/// <remarks/>

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.org/processMessage",
RequestNamespace="http://tempuri.org/",
ResponseNamespace="http://tempuri.org/",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]

public System.Xml.XmlNode processMessage(System.Xml.XmlNode mes) {

object[] results = this.Invoke("processMessage", new object[] {

mes});

return ((System.Xml.XmlNode)(results[0]));

}
/// <remarks/>

public void processMessageAsync(System.Xml.XmlNode mes) {

this.processMessageAsync(mes, null);

}
/// <remarks/>

public void processMessageAsync(System.Xml.XmlNode mes, object userState) {

if ((this.processMessageOperationCompleted == null)) {

this.processMessageOperationCompleted = new
System.Threading.SendOrPostCallback(this.Onprocess MessageOperationCompleted);

}

this.InvokeAsync("processMessage", new object[] {

mes}, this.processMessageOperationCompleted, userState);

}
private void OnprocessMessageOperationCompleted(object arg) {

if ((this.processMessageCompleted != null)) {

System.Web.Services.Protocols.InvokeCompletedEvent Args invokeArgs =
((System.Web.Services.Protocols.InvokeCompletedEve ntArgs)(arg));

this.processMessageCompleted(this, new
processMessageCompletedEventArgs(invokeArgs.Result s, invokeArgs.Error,
invokeArgs.Cancelled, invokeArgs.UserState));

}

}
/// <remarks/>

public new void CancelAsync(object userState) {

base.CancelAsync(userState);

}
private bool IsLocalFileSystemWebService(string url) {

if (((url == null)

|| (url == string.Empty))) {

return false;

}

System.Uri wsUri = new System.Uri(url);

if (((wsUri.Port >= 1024)

&& (string.Compare(wsUri.Host, "localHost",
System.StringComparison.OrdinalIgnoreCase) == 0))) {

return true;

}

return false;

}

}
/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Web.Services",
"2.0.50727.42")]

public delegate void processMessageCompletedEventHandler(object sender,
processMessageCompletedEventArgs e);
/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Web.Services",
"2.0.50727.42")]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("c ode")]

public partial class processMessageCompletedEventArgs :
System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal processMessageCompletedEventArgs(object[] results, System.Exception
exception, bool cancelled, object userState) :

base(exception, cancelled, userState) {

this.results = results;

}
/// <remarks/>

public System.Xml.XmlNode Result {

get {

this.RaiseExceptionIfNecessary();

return ((System.Xml.XmlNode)(this.results[0]));

}

}

}

}

How can i call this webservice with an

System.Xml.XmlDocument

and read the result with

System.Xml.XmlDocument

?

I'm using visual studio 2005.

Many thanks in advance

JJ

Feb 15 '06 #2
Many thanks Peter,
Well i was very unsure how to go from XmlNode to XmlDocument.
I have now been through a couple msdn pages and it now makes more sens to me
thanks to your posting.

JJ

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> skrev i en
meddelelse news:29**********************************@microsof t.com...
JJ,
I have noticed that attempting to return an XmlDocument from an ASP.NET
Webservice usually results in getting an XmlNode. So you can try getting
the
result of the WebService Call as XmlNode, and if you really require a
complete XmlDocument, just add the Node to a new instance of XmlDocument.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"jens Jensen" wrote:

Hello,
I need to call a webservice with an
System.Xml.XmlDocument objet and read the return value into and

System.Xml.XmlDocument. The webservice was written with an oracle tool
and
wrapped into a .net webservice.

I have added a reference to my dotnet wrapper and i get the following
refrence file:
using System.Diagnostics;

using System.Web.Services;

using System.ComponentModel;

using System.Web.Services.Protocols;

using System;

using System.Xml.Serialization;

/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Web.Services",
"2.0.50727.42")]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("c ode")]

[System.Web.Services.WebServiceBindingAttribute(Nam e="ServiceSoap",
Namespace="http://tempuri.org/")]

public partial class Service :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {
private System.Threading.SendOrPostCallback
processMessageOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <remarks/>

public Service() {

this.Url =
global::testMyWebService.Properties.Settings.Defau lt.testMyWebService_localhost_Service;

if ((this.IsLocalFileSystemWebService(this.Url) == true)) {

this.UseDefaultCredentials = true;

this.useDefaultCredentialsSetExplicitly = false;

}

else {

this.useDefaultCredentialsSetExplicitly = true;

}

}
public new string Url {

get {

return base.Url;

}

set {

if ((((this.IsLocalFileSystemWebService(base.Url) == true)

&& (this.useDefaultCredentialsSetExplicitly == false))

&& (this.IsLocalFileSystemWebService(value) == false))) {

base.UseDefaultCredentials = false;

}

base.Url = value;

}

}
public new bool UseDefaultCredentials {

get {

return base.UseDefaultCredentials;

}

set {

base.UseDefaultCredentials = value;

this.useDefaultCredentialsSetExplicitly = true;

}

}
/// <remarks/>

public event processMessageCompletedEventHandler processMessageCompleted;
/// <remarks/>

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.org/processMessage",
RequestNamespace="http://tempuri.org/",
ResponseNamespace="http://tempuri.org/",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]

public System.Xml.XmlNode processMessage(System.Xml.XmlNode mes) {

object[] results = this.Invoke("processMessage", new object[] {

mes});

return ((System.Xml.XmlNode)(results[0]));

}
/// <remarks/>

public void processMessageAsync(System.Xml.XmlNode mes) {

this.processMessageAsync(mes, null);

}
/// <remarks/>

public void processMessageAsync(System.Xml.XmlNode mes, object userState)
{

if ((this.processMessageOperationCompleted == null)) {

this.processMessageOperationCompleted = new
System.Threading.SendOrPostCallback(this.Onprocess MessageOperationCompleted);

}

this.InvokeAsync("processMessage", new object[] {

mes}, this.processMessageOperationCompleted, userState);

}
private void OnprocessMessageOperationCompleted(object arg) {

if ((this.processMessageCompleted != null)) {

System.Web.Services.Protocols.InvokeCompletedEvent Args invokeArgs =
((System.Web.Services.Protocols.InvokeCompletedEve ntArgs)(arg));

this.processMessageCompleted(this, new
processMessageCompletedEventArgs(invokeArgs.Result s, invokeArgs.Error,
invokeArgs.Cancelled, invokeArgs.UserState));

}

}
/// <remarks/>

public new void CancelAsync(object userState) {

base.CancelAsync(userState);

}
private bool IsLocalFileSystemWebService(string url) {

if (((url == null)

|| (url == string.Empty))) {

return false;

}

System.Uri wsUri = new System.Uri(url);

if (((wsUri.Port >= 1024)

&& (string.Compare(wsUri.Host, "localHost",
System.StringComparison.OrdinalIgnoreCase) == 0))) {

return true;

}

return false;

}

}
/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Web.Services",
"2.0.50727.42")]

public delegate void processMessageCompletedEventHandler(object sender,
processMessageCompletedEventArgs e);
/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Web.Services",
"2.0.50727.42")]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("c ode")]

public partial class processMessageCompletedEventArgs :
System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal processMessageCompletedEventArgs(object[] results,
System.Exception
exception, bool cancelled, object userState) :

base(exception, cancelled, userState) {

this.results = results;

}
/// <remarks/>

public System.Xml.XmlNode Result {

get {

this.RaiseExceptionIfNecessary();

return ((System.Xml.XmlNode)(this.results[0]));

}

}

}

}

How can i call this webservice with an

System.Xml.XmlDocument

and read the result with

System.Xml.XmlDocument

?

I'm using visual studio 2005.

Many thanks in advance

JJ

Feb 16 '06 #3
Hi Peter,
Could you please give a code example. I understand the idea but i haven't
found the right code yet.
Many thanks in advance
JJ
Feb 16 '06 #4
This is where I learned how to do it:

http://msdn.microsoft.com/library/de...tnodetopic.asp

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"jens Jensen" wrote:
Hi Peter,
Could you please give a code example. I understand the idea but i haven't
found the right code yet.
Many thanks in advance
JJ

Feb 16 '06 #5

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

Similar topics

1
by: James A. Donald | last post by:
I have an application, which needs to be rewritten into a webservice. The application is in C++, and my background is writing stuff for IIS in C++ and microsoft's javascript, but my intended...
1
by: Ricky K. Rasmussen | last post by:
Hi NG, When connecting to a local WebService one of our customers gets a very strange exception: "File or assembly name gaw9eaqv.dll, or one of its dependencies, was not found." The...
0
by: Helios | last post by:
Hello there, I'm new to webservices and have trouble getting started. I've got to develope a webservice which receives messages and in response to each message sends a response back. The...
1
by: Jensen Bredal | last post by:
Hello, I have written a very simple web service with only one "web method". The web method does what it is supposed to do when invoked locally but fails one invoked remotelly with http error 500....
2
by: Helbi | last post by:
Hi, i 've got some troubles with a webservice. I created it in local, and tested it also in local. My trouble come from putting the webservice on an other computer, ant trying to use it (normal...
0
by: S. Berwanger | last post by:
Hallo, I'm trouble debugging a Webservice application on the WinCE 4.1 emulator from VS 2003. The Webservice gives back Datasets from a SQL Database. When I'm starting the application for the...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
0
by: Eric bouxirot | last post by:
hi, i have some trouble to debug my webservice i have a server with SBS2003 (with domain controler) with IIS 6 my dev machine is XP Pro on WorkGroup with VS2005 if i run webservice and...
2
by: Jeff | last post by:
hi VS2008 I have trouble getting the AutoCompleteExtender to work. I've seen the video at http://www.asp.net:80/learn/ajax-videos/video-122.aspx but don't understand what I do wrong. I've...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.