This message was discovered on microsoft.public.dotnet.framework.aspnet.webservices.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
| Daniel Lee |
If I hit the web service hosted on Axis/Apache server from .NET by the usual route; get WSDL, create proxy, call from a ASP.NET.
A method of the WS is supposed to return a XML with data, however, the string the Web Method is returning is only the value of first element <HRMErrorText> in the SOAP response.
However, if I hit the WS using a standalone tool that can send SOAP request, it returns all the data correctly.
What is going on? Please help. I am getting frustrated~~
Thanks in advance! ====================================================== WSDL of WS: ====================================================== <?xml version="1.0" ?>
<definitions targetNamespace="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods" xmlns:tns="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="GetPartyAdditionalInfo"> <part name="usrName" type="xsd:string"/> <part name="usrPass" type="xsd:string"/> <part name="clientID1" type="xsd:string"/> <part name="clientID2" type="xsd:string"/> <part name="firstName" type="xsd:string"/> <part name="lastName" type="xsd:string"/> <part name="partyRoleCat" type="xsd:string"/> <part name="returnPrefs" type="xsd:string"/> </message>
<message name="GetPartyAdditionalInfoResponse"> <part name="TestResult" type="xsd:page"/> </message>
<message name="SearchEBOB"> <part name="usrName" type="xsd:string"/> <part name="usrPass" type="xsd:string"/> <part name="clientID1" type="xsd:string"/> <part name="clientID2" type="xsd:string"/> <part name="firstName" type="xsd:string"/> <part name="lastName" type="xsd:string"/> <part name="partyRoleCat" type="xsd:string"/> <part name="returnPrefs" type="xsd:string"/> </message>
<message name="SearchEBOBResponse"> <part name="TestResult" type="xsd:page"/> </message>
<portType name="TestMethodsType"> <operation name="GetPartyAdditionalInfo"> <input message="tns:GetPartyAdditionalInfo"/> <output message="tns:GetPartyAdditionalInfoResponse"/> </operation> <operation name="SearchEBOB"> <input message="tns:SearchEBOB"/> <output message="tns:SearchEBOBResponse"/> </operation> </portType>
<binding name="TestMethodsBinding" type="tns:TestMethodsType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="GetPartyAdditionalInfo"> <soap:operation style="rpc" soapAction="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods#GetPartyAd ditionalInfo"/> <input> <soap:body use="encoded" namespace="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body use="encoded" namespace="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> <operation name="SearchEBOB"> <soap:operation style="rpc" soapAction="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods#SearchEBOB "/> <input> <soap:body use="encoded" namespace="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body use="encoded" namespace="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding>
<service name="TestMethodsService"> <port name="TestMethodsPort" binding="tns:TestMethodsBinding"> <soap:address location="http://z0001-app0379-s:8080/prweb/PRSOAPServlet"/> </port> </service>
</definitions>
========================================================== THIS IS WHAT WS IS RETUNING WHEN USING XMLSPY TO SEND SOAP REQUET ==========================================================
<?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods"> <SOAP-ENV:Body> <ns:SearchEBOBResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <TestResult> <HRMErrorText> </HRMErrorText> <eBOBSearchResults> <rowdata> <ClientID2>88</ClientID2> <Gender>M</Gender> <State>MO </State> <FirstName>ALLEN</FirstName> <CityName>O FALLON </CityName> <ClientID1>1234567</ClientID1> <Zip>633661944 </Zip> <Role>1</Role> <LastName>TEST</LastName> <Birthdate>1977-05-21</Birthdate> </rowdata> </eBOBSearchResults> <HRMReturnCode> </HRMReturnCode> </TestResult> </ns:SearchEBOBResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
*** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
| |
| |
| Dino Chiesa [Microsoft] (VIP) |
you did not show us what is being sent in either case, and you did not show us what is being returned in the case where you use "the usual route".
Can you get a wire trace of the request and response, in both cases?
For this you can try Simon Fell's proxytrace - a free d/l from http://www.pocketsoap.com/tcptrace/pt.aspx ; to use this you will have to set the Proxy property on your webservice client-side stub. Set it to http://localhost:3128 or whatever port you run proxytrace on. You may also have to set the Url of the client-side stub, too, so that it is not "localhost" (localhost requests will not pass through the proxy) eg ws.Proxy = new System.Net.WebProxy("http://localhost:3128/"); ws.Url = "http://z0001-app0379-s:8080/prweb/PRSOAPServlet" ;
There is also a new tool called Fiddler which works similarly. http://www.bayden.com/Fiddler/version.asp
-D
"Daniel Lee" <Click here to reveal e-mail address> wrote in message news:%Click here to reveal e-mail address... [Original message clipped]
|
|
| |
| |
| D. Lee |
Thanks for introducing me the ProxyTrace!
Ok, this is what I have found. Per ProxyTrace, I can see the SOAPRequest and also the SOAPResponse which contains data (in XML) I want. Both SOAP messages are below. Now, it's .NET part somehow XML data is not being relayed back to the code. I am suspecting I must be doing something wrong handling or deserializing the returned data.
(!!!!) Another thing I noticed was that the text of SOAPResponse I copied from the ProxtTrace's window and pasted to Notepad (or XMLSPY), contains abnormal space character. This actually causes XMLSPY to error out while validating the XML format. I manually have to replace them with space. Might that be causing the problem in .NET???
Anyways, as u can see below, <HRMErrorText> is the first tag under <TestResult>. The string returned from the WebMethod call (searchEBOB) only returns the VALUE of the element. Since the tag is supposed to be blank, I get only blank string displayed. This is confirmed by the error message displayed if I pass wrong ID or value in one of the parameters.
Please~ please take a look the code and SOAP messages down here.
THANKS IN ADVANCE
============================== SOAP REQUEST MESSAGE ============================== <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods" xmlns:types="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods/encodedTy pes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <tns:SearchEBOB> <usrName xsi:type="xsd:string">Click here to reveal e-mail address</usrName> <usrPass xsi:type="xsd:string">geneva</usrPass> <clientID1 xsi:type="xsd:string">1234567</clientID1> <clientID2 xsi:type="xsd:string">50</clientID2> <firstName xsi:type="xsd:string"/> <lastName xsi:type="xsd:string">B*</lastName> <partyRoleCat xsi:type="xsd:string">C</partyRoleCat> <returnPrefs xsi:type="xsd:string">Y</returnPrefs> </tns:SearchEBOB> </soap:Body> </soap:Envelope>
============================== SOAP RESPONSE MESSAGE ============================== HTTP/1.1 200 OK Set-Cookie: Pega-RULES=AF5A3C013623; Path=/ Content-Type: text/xml;charset=UTF-8 Content-Length: 5502 Date: Wed, 30 Jun 2004 13:41:47 GMT Server: Apache Coyote/1.0
<?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods"> <SOAP-ENV:Body> <ns:SearchEBOBResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <TestResult> <HRMErrorText> </HRMErrorText> <eBOBSearchResults> <rowdata> <ClientID2>88</ClientID2> <Gender>M</Gender> <State>MO </State> <FirstName>ALLEN</FirstName> <CityName>O FALLON </CityName> <ClientID1>6436w</ClientID1> <Zip>63360 </Zip> <Role>1</Role> <LastName>BACHER</LastName> <Birthdate>1966-05-21</Birthdate> </rowdata> </eBOBSearchResults> <HRMReturnCode> </HRMReturnCode> </TestResult> </ns:SearchEBOBResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
======================================= .NET CODE - PROXY CODE ======================================= [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="TestMethodsBinding ", Namespace="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods")] public class TestMethodsService : System.Web.Services.Protocols.SoapHttpClientProtocol {
/// <remarks/> public TestMethodsService() { this.Proxy = new System.Net.WebProxy("http://localhost:3128/"); this.Url = "http://z0001-app0379-s:8080/prweb/PRSOAPServlet"; }
/// <remarks/>
[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:PegaRULES:SOA P:ToolkitWebServices:TestMethods#GetPartyAdditionalInfo", RequestNamespace="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods", ResponseNamespace="urn:PegaRULES:SOAP:ToolkitWebServices:TestMethods")] [return: System.Xml.Serialization.SoapElementAttribute("TestResult")] public string GetPartyAdditionalInfo(string usrName, string usrPass, string clientID1, string clientID2, string firstName, string lastName, string partyRoleCat, string returnPrefs) { object[] results = this.Invoke("GetPartyAdditionalInfo", new object[] { usrName, usrPass, clientID1, clientID2, firstName, lastName, partyRoleCat, returnPrefs}); return ((string)(results[0])); }
//--- THIS IS WHAT WSDL.EXE CREATED.
======================================= .NET CODE - DISPLAYING ======================================= sTmp = oWS.SearchEBOB ("Click here to reveal e-mail address","geneva","1234567","50","","B*","C","Y");
txReturn.Text =sTmp;
//--- THIS DISPLAYS THE CONTENT OF THE FIRST TAG <HRMErrorText> OF RETURNED XML SOAPRESPONSE. FOR NORMAL CASE, THE TAG IS ALWAYS BLANK STRING. THEREFORE ALL I SEE ON THE TEXT BOX ON WEBFORM IS BLANK STRING.
*** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
| |
| |
| Dino Chiesa [Microsoft] (VIP) |
"D. Lee" <Click here to reveal e-mail address> wrote in message news:Click here to reveal e-mail address... [Original message clipped]
Yes, something is not right.
1. The WSDL says you are returning a string, when in fact the return data contains valid (not escaped) XML.
The response contains <HRMErrorText> </HRMErrorText> <eBOBSearchResults> lots of other stuff </eBOBSearchResults>
(including the newlines).
But the WSDL says "it's a string". So the WSDL does not agree with the actual implementation. You have something broken there.
2. I don't know what you mean by "abnormal space character". You didn't say where this occurs, exactly.
3. You have said that the return string apparently contains the Text value of the <HRMErrorText> element. Are you sure about this? Can you double check this for me? Run it through a debugger and examine sTmp before dumping it into a textbox? In both the error case and the normal case?
-D
[Original message clipped]
|
|
| |
| |
| D. Lee |
Ok, let me ask you this way.
The .NET client is successfully displaying if the returned XML from the SOAP call looks like this. ================================================= SOAP Response ================================================= <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:PegaRULES:dotNet:TestDotNet:TestSearch"> <SOAP-ENV:Body> <ns:SearchDotNetResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <DotNetResults> <HRMErrorText>WKFSU14 0120-EDIT-PARMS INTRNT USER ID OR PARTY-ID REQUIRED </HRMErrorText> </DotNetResults> </ns:SearchDotNetResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> ===================================================
With this coming back from the web service, the .NET client is picking the TEXT of <HRMErrorText> element and display to a text box on a web form.
However, now, if the returning SOAP looks like this, the .NET client errors out. This time there is meaningful data returning in a new tag <GetPartyResults> and <HRMErrorText> is pushed to bottom.
What does this mean? Is there something SOAP response to cause the .NET client to error out while deserializing or parsing the SOAP envelope? Some sort of name space or schema related issue????
Please~~ Help me ~~~ !!!
=================================================== SOAP Response that errors .NET client out =================================================== <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:PegaRULES:dotNet:TestDotNet:TestSearch"> <SOAP-ENV:Body> <ns:SearchDotNetResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <DotNetResults> <GetPartyResults> <EmailAddress>Click here to reveal e-mail address </EmailAddress> <Gender>M</Gender> <State>UT</State> <Zip>843329434</Zip> <ProductList>Personal Umbrella, Homeowners, Auto, Life</ProductList> <ClientStatusType>Customer</ClientStatusType> <PhoneNumber>4444433</PhoneNumber> <CityName>PROVIDENCE</CityName> <FirstName>GERALD</FirstName> <AddressLine1>545 SPRING CREEK RD</AddressLine1> <PhoneAreaCode>435 </PhoneAreaCode> <LastName>DAY</LastName> </GetPartyResults> <HRMErrorText> </HRMErrorText> </DotNetResults> </ns:SearchDotNetResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
==================================================== .NET Client Error Message ==================================================== Server Error in '/WS_Test' Application. ------------------------------------------------------------------------ --------
'Text' is an invalid node type. Line 10, position 47. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Xml.XmlException: 'Text' is an invalid node type. Line 10, position 47.
Source Error:
Line 36: [return: System.Xml.Serialization.SoapElementAttribute("DotNetResults")] Line 37: public string SearchDotNet(string usrName, string usrPass, string clientID1, string clientID2) { Line 38: object[] results = this.Invoke("SearchDotNet", new object[] { Line 39: usrName, Line 40: usrPass,
Source File: c:\inetpub\wwwroot\ws_test\newdotnet.cs Line: 38
Stack Trace:
[XmlException: 'Text' is an invalid node type. Line 10, position 47.] System.Xml.XmlReader.ReadEndElement() System.Xml.Serialization.XmlSerializationReader.ReadEndElement() System.Xml.Serialization.XmlSerializationReader.ReadStringValue()
System.Xml.Serialization.XmlSerializationReader.ReadTypedPrimitive(XmlQu alifiedName type, Boolean elementCanBeType)
System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(S tring name, String ns, Boolean elementCanBeType, String& fixupReference)
System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(S tring name, String ns, String& fixupReference)
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Re ad3_SearchDotNetResponse()
[InvalidOperationException: There is an error in XML document (10, 47).] System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapCl ientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) TestSearchService.SearchDotNet(String usrName, String usrPass, String clientID1, String clientID2) in c:\inetpub\wwwroot\ws_test\newdotnet.cs:38 WS_Test.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\ws_test\webform1.aspx.cs:60 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Rai sePostBackEvent(String eventArgument) System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) System.Web.UI.Page.ProcessRequestMain()
*** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
| |
|
| |
| D. Lee |
Hi Dino,
Thanks so much for your response!
Ok, I wanted to add answers to your questions here on top of the posting I just made.
To answer your question,
#1. Yes... something is not right with the WSDL, right? In wsdl, the response type is "xsd:page". This is not how it is supposed to be if the returning data is a well-formed XML, right? So with this, can I assume the WSDL generated by the Web Service is the cause of this? <message name="SearchEBOBResponse"> <part name="EBOBResults" type="xsd:page" /> </message>
#2. Well, plz ignore about this for now.
#3. Yes I am 100% positive on this. And this is explained further with response samples in the posting I just made right before this.
If you could help me on this, I would greatly greatly appreciate. Once this is resolved, I'd study deep in WSDL and Schema...
LOTS LOTS OF THANKS IN ADVANCE -D.Lee
*** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
| |
|
|
|
|
|
|
|
|