471,318 Members | 3,236 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,318 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 6111
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by James A. Donald | last post: by
1 post views Thread by Ricky K. Rasmussen | last post: by
1 post views Thread by Jensen Bredal | last post: by
2 posts views Thread by Helbi | last post: by
reply views Thread by S. Berwanger | last post: by
reply views Thread by Eric bouxirot | last post: by
2 posts views Thread by Jeff | last post: by
reply views Thread by rosydwin | last post: by

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.