cancel
Showing results for 
Search instead for 
Did you mean: 

calling SAP Netweaver web service from .Net Client

Former Member
0 Kudos

Hi all,

i have an ejb with following methods

1. valid

2. getdetail

first method returns a simple string. and second returns a object which has many string in it. this returned object has all the getter ans setter funcation as well as it implements serilizable interface.

Now i have exposed this Ejb as web service. and i am trying to consume this web service from a .Net client but it gives following error.

Unhandled Exception: System.InvalidOperationException: There is an error in XML document (1, 407). ---> System.Xml.XmlException: This is an unexpected token. The expected token is 'EndElement'. Line 1, position 407.

at System.Xml.XmlTextReader.Read()

at System.Xml.XmlReader.ReadElementString()

at System.Xml.Serialization.XmlSerializationReader.ReadNullableString()

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read9_CostCenter_ListOutputImpl(Boolean isNullable, Boolean checkType)

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read8_CostCenter_ListOutput(Boolean isNullable, Boolean checkType)

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read18_getListResponse()

--- End of inner exception stack trace ---

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, XmlDeserializationEvents events)

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)

at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

at CostCenterSearchUI.CostCenterService.CostCenterService.getList(String costcenter, String controllingArea, String company, DateTime date, String lang, String[] instance, String[] client) in C:\Documents and Settings\divy\Desktop\CostCenterSearchDotNetUI\CostCenterSearchUI\Web References\CostCenterService\Reference.cs:line 71

at CostCenterSearchUI.Form1.btnGetList_Click(Object sender, EventArgs e) in c:\documents and settings\divy\desktop\costcentersearchdotnetui\costcentersearchui\form1.cs:line 304

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ButtonBase.WndProc(Message& m)

at System.Windows.Forms.Button.WndProc(Message& m)

at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)

at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationCoThe program '[4136] CostCenterSearchUI.exe' has exited with code 0 (0x0).

ntext context)

at System.Windows.Forms.Application.Run(Form mainForm)

what might be the reason?

is it because soap message return by the web service is not compatable with dotNet. if it is so then we are loosing advantage of the web service.

Accepted Solutions (0)

Answers (1)

Answers (1)

reiner_hille-doering
Active Contributor
0 Kudos

You should use a network sniffer (e.g. Ethereal) or a debugger so see what goes over the wire. It seems that somewhere on Java side an XML document is protuced that is either invalid or doesn't fit to the schema that came with the WSDL that you used to create the proxy.

Former Member
0 Kudos

Hi Reiner,

Thanks for the reply.

i have used this web service from java client and it runs successfully.

so i think the xml genrated by web service is ok.

to see the xml genrated i have tested the web service using SAP WAS's test tool. it displays the xml document. but how can i know weather the XML genrated is valid according to WSDL or not with respect to dotNet.

but i still feel that as from java client we are able to call the service so XML is ok according to WSDL.

reiner_hille-doering
Active Contributor
0 Kudos

The fact that Java can use the WS does not necesserily mean that it is correct. There can be very subtile differences that have different effects on Java and .NET. You should still try to get the exactly XML as it is dererialized in .NET and go to line 1, column 407 to see what's there. Then carefully compare with the schema.

Former Member
0 Kudos

i tested the web service on the WAS by going to the URL

http://localhost:50000/wsnavigator/enterwsdl.html

Here i tested the web service. This display the XML returned by the web service. Here at line 1 and column 407 i can see

<rpl:Response xsi:type='tns:CostCenter_ListOutputImpl' xmlns:pns='urn:com.sap.CostCenterSearchAPI' xmlns:tns='urn:com.sap.CostCenterSearchAPI.Impl'<b><u>><</u></b>pns:message>

reiner_hille-doering
Active Contributor
0 Kudos

Ok, now: What does the XML schema in the WSDL say about the format of the response message? You may post the whole WSDL if you want.

Former Member
0 Kudos

Hi Reiner,

Thanks for your intrest.

can you give me your mail id so that i can send you the WSDL and the XML message.

Thanks again...

Former Member
0 Kudos

Hi Reiner,

Thanks for your intrest.

can you give me your mail id so that i can send you the WSDL and the XML message.

Thanks again...

reiner_hille-doering
Active Contributor
0 Kudos

I already sent you a mail yesterday (with the other name) and now again with your current name.

Former Member
0 Kudos

Hi all,

for the above error i was able to create web service client in VB .NET (but it failed in C# .Net)

And now i have error that after moving the web service from local WAS to Development system using Track's in JDI

the VB client gives the error about <b>Time out</b>. i can call same web service from Java (it does not gives me Connection time out error)

if the server is behind the fire wall than java client should also give connection time out error

Former Member
0 Kudos

Hi all,

From the server log i found following dump when i call the web service from .Net

<b>#1.5#0012799E22C2005000000023000012740004040BFBDEDEC3#1130349423595#com.sap.engine.services.servlets_jsp.client.RequestInfoServer#chevron/dc~ea_wstst#com.sap.engine.services.servlets_jsp.client.RequestInfoServer#J2EE_GUEST#0####ea27e150464911daa8760012799e22c2#SAPEngine_Application_Thread[impl:3]_12##0#0#Error##Plain###Cannot send an HTTP error response [500 Application error occurred during request processing. (details: Error [javax.servlet.ServletException: com.sap.engine.services.servlets_jsp.server.exceptions.WebIllegalStateException: The stream has already been committed.</b>

Still i don't understand why i am able to call web service from java but not by .Net

and in .Net i am able to call the web service on local server but remote server gives above dump.

and when i call the web service on the local system i am able to call the web service from VB .Net but not with C#. (i have made sure that both the code are correct)