473,396 Members | 2,070 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,396 software developers and data experts.

badly formed XML when calling a web service

AI am trying to call a third-party web service. this service expects an XML
fragment that contains the request plus other parameter. adding the web
reference created the syntax below(reference.vb).

I changed the data type for the structure that contains the XML data from
the default "String" to "xml.xmldocument" to enable easy filling of the
data.

my client code creates an XML document class, fills the data using standard
xml dom calls, and then invokes the web service.

the server refuses my call because the XML element below the root element
(customerGeneralInquiryRequests ) contains an empty "xmlns" attribute. How
do I get rid of it? I tried to define PDataXML as a node, explicitly declare
the namespace as "nothing" when calling "CreateElement", nothing helps!

attached: samples from the reference file, my code that fills the XML
framgment, the WSDL retrieved from the web serrver, and from the output
trace.

any help will be appreciated!
note: a second question. the process by which the "p0" and "PDataXML"
elements are created in the request body are unclear to me. can anyone
explain or refer to good explanations? thanks!
---- FROM the client code --------------------------
Dim svc As New ServiceRootSoap

<SNIPPED CODE>

Dim aResult As CallServiceResponse

Dim aRequest As New CallService

Dim aRootNode, aDataNode As XmlNode

Dim aXMLDoc As New XmlDocument

aRootNode = aXMLDoc.CreateElement(Nothing, "customerGeneralInquiryRequests",
Nothing)

aXMLDoc.AppendChild(aRootNode)

<SNIPPED CODE>
aRequest.PDataXML = aXMLDoc

Try

aResult = svc.CallService(aRequest)

---- END OF from client code ----------------------

---- FROM reference.vb -------------------------------
<System.Web.Services.Protocols.SoapHeaderAttribute ("scsServiceHeader"), _
System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://webservice
s.hedberg.comServiceRootSoap#CallService?KExzdGVlb GNhc2Uvc2VydmV"& _
"yL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZpY2U7KUxzdGVlbGNh c2Uvc2VydmVyL2lmYWNlcy9zdH
J1Y3Q"& _

"vQ2FsbFNlcnZpY2VSZXNwb25zZTs=",
Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Bare)>
_Public Function
CallService(<System.Xml.Serialization.XmlElementAt tribute([Namespace]:="http
://systinet.com/xsd/SchemaTypes/", IsNullable:=true)> ByVal p0 As
CallService) As
<System.Xml.Serialization.XmlElementAttribute("Cal lServiceResponse_Response"
, [Namespace]:="http://systinet.com/xsd/SchemaTypes/", IsNullable:=true)>
CallServiceResponse

Dim results() As Object = Me.Invoke("CallService", New Object() {p0})

Return CType(results(0),CallServiceResponse)

End Function

...........

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://systinet.com
/wsdl/steelcase/server/ifaces/struct/")> _

Public Class CallService
'<remarks/>

<System.Xml.Serialization.XmlElementAttribute(IsNu llable:=True)> _

Public PDataXML As Xml.XmlDocument 'string

.......

---- END OF from reference.vb ----------------------------------

---- FROM the output trace ---------------------------------------
<soap:Body wsu:Id="Id-61872b1c-682f-49eb-9c07-bd40aa4b42b1">
<p0 xmlns="http://systinet.com/xsd/SchemaTypes/">
<PDataXML
xmlns="http://systinet.com/wsdl/steelcase/server/ifaces/struct/">
<customerGeneralInquiryRequests xmlns="">
<customerGeneralInquiryRequest>
.........
---- END OF from the output trace ---------------------------------------


---- FROM the WSDL----------------------------------------------
.............
<xsd:complexType name="CallService">

<xsd:annotation>

<xsd:appinfo>

<map:java-type name="steelcase.server.ifaces.struct.CallService" />

</xsd:appinfo>

</xsd:annotation>

<xsd:sequence>

<xsd:element name="PDataXML" nillable="true" type="xsd:string" />

<xsd:element name="PInstructionsXML" nillable="true" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

<xsd:complexType name="CallServiceResponse">

<xsd:annotation>

<xsd:appinfo>

<map:java-type name="steelcase.server.ifaces.struct.CallServiceRe sponse" />

</xsd:appinfo>

</xsd:annotation>

<xsd:sequence>

<xsd:element name="callServiceResult" nillable="true" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

</s:schema>

<s:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://systinet.com/xsd/SchemaTypes/"
xmlns:xns4="http://systinet.com/wsdl/steelcase/server/ifaces/struct/"
elementFormDefault="qualified"
targetNamespace="http://systinet.com/xsd/SchemaTypes/">

<xsd:import
namespace="http://systinet.com/wsdl/steelcase/server/ifaces/struct/" />

<xsd:element name="p0" nillable="true" type="xns4:CallService" />

<xsd:element name="CallServiceResponse_Response" nillable="true"
type="xns4:CallServiceResponse" />

</s:schema>

</wsdl:types>

<wsdl:message name="ServiceRootSoap_CallService_Response_Soap">

<wsdl:part name="response" element="s3:CallServiceResponse_Response" />

</wsdl:message>

<wsdl:message name="ServiceRootSoap_CallService__Request_Soap">

<wsdl:part name="p0" element="s3:p0" />

</wsdl:message>

<wsdl:message name="ServiceRootSoap_header_Soap">

<wsdl:part name="header_0" element="s2:scsServiceHeader" />

</wsdl:message>

<wsdl:message name="runtimeHeaders_0">

<wsdl:part name="header_0" element="s1:instance" />

<wsdl:part name="header_1" element="s0:TxId" />

</wsdl:message>

<wsdl:portType name="ServiceRootSoap">

<wsdl:operation name="CallService" parameterOrder="p0">

<wsdl:input message="tns:ServiceRootSoap_CallService__Request_ Soap" />

<wsdl:output message="tns:ServiceRootSoap_CallService_Response_ Soap" />

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="ServiceRootSoap" type="tns:ServiceRootSoap">

<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />

<wsdl:operation name="CallService">

<map:java-operation name="CallService"
signature="KExzdGVlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ 1Y3QvQ2FsbFNlcnZpY2U7KUxzd
GVlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZ pY2VSZXNwb25zZTs="
xmlns:map="http://systinet.com/mapping/" />

<soap:operation
soapAction="http://webservices.hedberg.comServiceRootSoap#CallService ?KExzdG
VlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZp Y2U7KUxzdGVlbGNhc2Uvc2Vydm
VyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZpY2VSZXNwb25zZTs= " style="document" />

<wsdl:input>

<soap:body use="literal" parts="p0" />

<soap:header message="tns:ServiceRootSoap_header_Soap" part="header_0"
use="literal" />

</wsdl:input>

<wsdl:output>

<soap:body use="literal" parts="response" />

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="ServiceRootSoap">

<wsdl:port name="ServiceRootSoap" binding="tns:ServiceRootSoap">

<soap:address location="http://<deleted>/ServiceRoot" />

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

---------- END OF from the WSDL -----------------------------------------
Nov 23 '05 #1
3 5030
Hi Jerome,

There isn't enough of the WSDL Types section in your post to determine what
the right value for the namespace should be. If the WSDL is correctly
formed, add-web-reference should do the job. You shouldn't have to be
sending XML fragments - you can work with well formed classes (if you
prefer). If you are creating the XML nodes by hand, you should use
CreateNode instead of CreateElement so you can pass in the right namespace
value. The targetNamespace from the schema in the WSDL types section
should be the value you pass.

I hope this helps,

Dan Rogers
Microsoft Corporation
--------------------
From: "Jerome Cohen" <yo**********@structuredweb.com>
Subject: badly formed XML when calling a web service
Date: Tue, 14 Dec 2004 21:44:16 -0500
Lines: 273
Organization: SW
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Message-ID: <Op**************@TK2MSFTNGP14.phx.gbl>
Newsgroups:
microsoft.public.dotnet.framework.webservices,micr osoft.public.dotnet.framew
ork.webservices.enhancements,microsoft.public.webs ervices
NNTP-Posting-Host: 66.45.236.227
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP14
.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices.enha ncements:5156
microsoft.public.webservices:2599
microsoft.public.dotnet.framework.webservices:8101
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

AI am trying to call a third-party web service. this service expects an XML
fragment that contains the request plus other parameter. adding the web
reference created the syntax below(reference.vb).

I changed the data type for the structure that contains the XML data from
the default "String" to "xml.xmldocument" to enable easy filling of the
data.

my client code creates an XML document class, fills the data using standard
xml dom calls, and then invokes the web service.

the server refuses my call because the XML element below the root element
(customerGeneralInquiryRequests ) contains an empty "xmlns" attribute. How
do I get rid of it? I tried to define PDataXML as a node, explicitly declare
the namespace as "nothing" when calling "CreateElement", nothing helps!

attached: samples from the reference file, my code that fills the XML
framgment, the WSDL retrieved from the web serrver, and from the output
trace.

any help will be appreciated!
note: a second question. the process by which the "p0" and "PDataXML"
elements are created in the request body are unclear to me. can anyone
explain or refer to good explanations? thanks!
---- FROM the client code --------------------------
Dim svc As New ServiceRootSoap

<SNIPPED CODE>

Dim aResult As CallServiceResponse

Dim aRequest As New CallService

Dim aRootNode, aDataNode As XmlNode

Dim aXMLDoc As New XmlDocument

aRootNode = aXMLDoc.CreateElement(Nothing, "customerGeneralInquiryRequests",
Nothing)

aXMLDoc.AppendChild(aRootNode)

<SNIPPED CODE>
aRequest.PDataXML = aXMLDoc

Try

aResult = svc.CallService(aRequest)

---- END OF from client code ----------------------

---- FROM reference.vb -------------------------------
<System.Web.Services.Protocols.SoapHeaderAttribute ("scsServiceHeader"), _
System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://webservice
s.hedberg.comServiceRootSoap#CallService?KExzdGVlb GNhc2Uvc2VydmV"& _
"yL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZpY2U7KUxzdGVlbGNh c2Uvc2VydmVyL2lmYWNlcy9zdH
J1Y3Q"& _

"vQ2FsbFNlcnZpY2VSZXNwb25zZTs=",
Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Bare)>
_Public Function
CallService(<System.Xml.Serialization.XmlElementAt tribute([Namespace]:="http
://systinet.com/xsd/SchemaTypes/", IsNullable:=true)> ByVal p0 As
CallService) As
<System.Xml.Serialization.XmlElementAttribute("Cal lServiceResponse_Response"
, [Namespace]:="http://systinet.com/xsd/SchemaTypes/", IsNullable:=true)>
CallServiceResponse

Dim results() As Object = Me.Invoke("CallService", New Object() {p0})

Return CType(results(0),CallServiceResponse)

End Function

..........

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://systinet.com
/wsdl/steelcase/server/ifaces/struct/")> _

Public Class CallService
'<remarks/>

<System.Xml.Serialization.XmlElementAttribute(IsNu llable:=True)> _

Public PDataXML As Xml.XmlDocument 'string

......

---- END OF from reference.vb ----------------------------------

---- FROM the output trace ---------------------------------------
<soap:Body wsu:Id="Id-61872b1c-682f-49eb-9c07-bd40aa4b42b1">
<p0 xmlns="http://systinet.com/xsd/SchemaTypes/">
<PDataXML
xmlns="http://systinet.com/wsdl/steelcase/server/ifaces/struct/">
<customerGeneralInquiryRequests xmlns="">
<customerGeneralInquiryRequest>
........
---- END OF from the output trace ---------------------------------------


---- FROM the WSDL----------------------------------------------
............
<xsd:complexType name="CallService">

<xsd:annotation>

<xsd:appinfo>

<map:java-type name="steelcase.server.ifaces.struct.CallService" />

</xsd:appinfo>

</xsd:annotation>

<xsd:sequence>

<xsd:element name="PDataXML" nillable="true" type="xsd:string" />

<xsd:element name="PInstructionsXML" nillable="true" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

<xsd:complexType name="CallServiceResponse">

<xsd:annotation>

<xsd:appinfo>

<map:java-type name="steelcase.server.ifaces.struct.CallServiceRe sponse" />

</xsd:appinfo>

</xsd:annotation>

<xsd:sequence>

<xsd:element name="callServiceResult" nillable="true" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

</s:schema>

<s:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://systinet.com/xsd/SchemaTypes/"
xmlns:xns4="http://systinet.com/wsdl/steelcase/server/ifaces/struct/"
elementFormDefault="qualified"
targetNamespace="http://systinet.com/xsd/SchemaTypes/">

<xsd:import
namespace="http://systinet.com/wsdl/steelcase/server/ifaces/struct/" />

<xsd:element name="p0" nillable="true" type="xns4:CallService" />

<xsd:element name="CallServiceResponse_Response" nillable="true"
type="xns4:CallServiceResponse" />

</s:schema>

</wsdl:types>

<wsdl:message name="ServiceRootSoap_CallService_Response_Soap">

<wsdl:part name="response" element="s3:CallServiceResponse_Response" />

</wsdl:message>

<wsdl:message name="ServiceRootSoap_CallService__Request_Soap">

<wsdl:part name="p0" element="s3:p0" />

</wsdl:message>

<wsdl:message name="ServiceRootSoap_header_Soap">

<wsdl:part name="header_0" element="s2:scsServiceHeader" />

</wsdl:message>

<wsdl:message name="runtimeHeaders_0">

<wsdl:part name="header_0" element="s1:instance" />

<wsdl:part name="header_1" element="s0:TxId" />

</wsdl:message>

<wsdl:portType name="ServiceRootSoap">

<wsdl:operation name="CallService" parameterOrder="p0">

<wsdl:input message="tns:ServiceRootSoap_CallService__Request_ Soap" />

<wsdl:output message="tns:ServiceRootSoap_CallService_Response_ Soap" />

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="ServiceRootSoap" type="tns:ServiceRootSoap">

<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />

<wsdl:operation name="CallService">

<map:java-operation name="CallService"
signature="KExzdGVlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ 1Y3QvQ2FsbFNlcnZpY2U7KUxzd
GVlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZ pY2VSZXNwb25zZTs="
xmlns:map="http://systinet.com/mapping/" />

<soap:operation
soapAction="http://webservices.hedberg.comServiceRootSoap#CallService ?KExzdG
VlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZp Y2U7KUxzdGVlbGNhc2Uvc2Vydm
VyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZpY2VSZXNwb25zZTs= " style="document" />

<wsdl:input>

<soap:body use="literal" parts="p0" />

<soap:header message="tns:ServiceRootSoap_header_Soap" part="header_0"
use="literal" />

</wsdl:input>

<wsdl:output>

<soap:body use="literal" parts="response" />

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="ServiceRootSoap">

<wsdl:port name="ServiceRootSoap" binding="tns:ServiceRootSoap">

<soap:address location="http://<deleted>/ServiceRoot" />

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

---------- END OF from the WSDL -----------------------------------------

Nov 23 '05 #2
Dan,

thanks for the answer.

I think the problem is that the people who developed the web service treat
the "PDataXML" as a string. since when creating the XML doc the empty xmlns
was added to the root element, their server rejects the call. the error I am
getting from them is "Bad message : expected text, got start of element
{}customerGeneralInquiryRequests "
they claim the specific problem is that empty xmlns I get on the element
"customerGeneralInquiryRequests ". who is creating this? even when I changed
the code so it creates the whole xml document in one LoadXML call, I still
get this empty xmlns.

<PDataXML xmlns="http://systinet.com/wsdl/steelcase/server/ifaces/struct/">
<customerGeneralInquiryRequests xmlns="">
I am attaching the entire WSDL file

thanks, Jerome
------------------------------- WSDL
file ---------------------------------------------
<?xml version="1.0" encoding="utf-8"?>

<wsdl:definitions xmlns:s1="http://idoox.com/interface"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://systinet.com/soap-jta/"
xmlns:s3="http://systinet.com/xsd/SchemaTypes/"
xmlns:s2="http://systinet.com/wsdl/steelcase/server/ifaces/struct/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://webservices.hedberg.com"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://webservices.hedberg.com"
name="steelcase.server.ifaces.ServiceRootSoap"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

<wsdl:types>

<s:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://systinet.com/soap-jta/" elementFormDefault="qualified"
targetNamespace="http://systinet.com/soap-jta/">

<xsd:element name="TxId">

<xsd:complexType>

<xsd:sequence>

<xsd:element name="id" nillable="true" type="xsd:string" />

<xsd:element name="NoTxResume" nillable="true" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

</s:schema>

<s:schema xmlns:tns="http://idoox.com/interface"
xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="http://idoox.com/interface">

<s:complexType name="serviceReference">

<s:sequence>

<s:element name="service" type="s:QName" />

<s:element name="wsdl" type="s:anyURI" />

<s:element minOccurs="0" name="instanceID" type="s:string" />

<s:element minOccurs="0" name="portTypeMappings"
type="tns:ArrayOfInterfaceMapping" />

</s:sequence>

</s:complexType>

<s:complexType name="ArrayOfInterfaceMapping">

<s:sequence>

<s:element minOccurs="0" maxOccurs="unbounded" name="item"
type="tns:interfaceMapping" />

</s:sequence>

</s:complexType>

<s:complexType name="interfaceMapping">

<s:sequence>

<s:element name="portType" type="s:QName" />

<s:element name="className" type="s:string" />

</s:sequence>

</s:complexType>

<s:element name="instance">

<s:annotation>

<s:documentation>

this is the SOAP header schema

this SOAP header SHOULD have soap-env:mustUnderstand set to "1"

this header MUST be present at most once in any message

</s:documentation>

</s:annotation>

<s:complexType>

<s:choice>

<s:element name="id" type="s:string" />

<s:element name="setId" type="s:string" />

<s:element name="notFound" type="s:string" />

</s:choice>

</s:complexType>

</s:element>

</s:schema>

<s:schema
xmlns:tns="http://systinet.com/wsdl/steelcase/server/ifaces/struct/"
xmlns:map="http://systinet.com/mapping/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="http://systinet.com/wsdl/steelcase/server/ifaces/struct/">

<xsd:complexType name="ScsServiceHeader">

<xsd:annotation>

<xsd:appinfo>

<map:java-type name="steelcase.server.ifaces.struct.ScsServiceHea der" />

</xsd:appinfo>

</xsd:annotation>

<xsd:sequence>

<xsd:element name="callingSystem" nillable="true" type="xsd:string" />

<xsd:element name="requestID" nillable="true" type="xsd:string" />

<xsd:element name="serviceName" nillable="true" type="xsd:string" />

<xsd:element name="serviceVersion" nillable="true" type="xsd:string" />

<xsd:element name="tradingPartnerID" nillable="true" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

<xsd:element name="scsServiceHeader" nillable="true"
type="tns:ScsServiceHeader" />

<xsd:complexType name="CallService">

<xsd:annotation>

<xsd:appinfo>

<map:java-type name="steelcase.server.ifaces.struct.CallService" />

</xsd:appinfo>

</xsd:annotation>

<xsd:sequence>

<xsd:element name="PDataXML" nillable="true" type="xsd:string" />

<xsd:element name="PInstructionsXML" nillable="true" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

<xsd:complexType name="CallServiceResponse">

<xsd:annotation>

<xsd:appinfo>

<map:java-type name="steelcase.server.ifaces.struct.CallServiceRe sponse" />

</xsd:appinfo>

</xsd:annotation>

<xsd:sequence>

<xsd:element name="callServiceResult" nillable="true" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

</s:schema>

<s:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://systinet.com/xsd/SchemaTypes/"
xmlns:xns4="http://systinet.com/wsdl/steelcase/server/ifaces/struct/"
elementFormDefault="qualified"
targetNamespace="http://systinet.com/xsd/SchemaTypes/">

<xsd:import
namespace="http://systinet.com/wsdl/steelcase/server/ifaces/struct/" />

<xsd:element name="p0" nillable="true" type="xns4:CallService" />

<xsd:element name="CallServiceResponse_Response" nillable="true"
type="xns4:CallServiceResponse" />

</s:schema>

</wsdl:types>

<wsdl:message name="ServiceRootSoap_CallService_Response_Soap">

<wsdl:part name="response" element="s3:CallServiceResponse_Response" />

</wsdl:message>

<wsdl:message name="ServiceRootSoap_CallService__Request_Soap">

<wsdl:part name="p0" element="s3:p0" />

</wsdl:message>

<wsdl:message name="ServiceRootSoap_header_Soap">

<wsdl:part name="header_0" element="s2:scsServiceHeader" />

</wsdl:message>

<wsdl:message name="runtimeHeaders_0">

<wsdl:part name="header_0" element="s1:instance" />

<wsdl:part name="header_1" element="s0:TxId" />

</wsdl:message>

<wsdl:portType name="ServiceRootSoap">

<wsdl:operation name="CallService" parameterOrder="p0">

<wsdl:input message="tns:ServiceRootSoap_CallService__Request_ Soap" />

<wsdl:output message="tns:ServiceRootSoap_CallService_Response_ Soap" />

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="ServiceRootSoap" type="tns:ServiceRootSoap">

<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />

<wsdl:operation name="CallService">

<map:java-operation name="CallService"
signature="KExzdGVlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ 1Y3QvQ2FsbFNlcnZpY2U7KUxzd
GVlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZ pY2VSZXNwb25zZTs="
xmlns:map="http://systinet.com/mapping/" />

<soap:operation
soapAction="http://webservices.hedberg.comServiceRootSoap#CallService ?KExzdG
VlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZp Y2U7KUxzdGVlbGNhc2Uvc2Vydm
VyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZpY2VSZXNwb25zZTs= " style="document" />

<wsdl:input>

<soap:body use="literal" parts="p0" />

<soap:header message="tns:ServiceRootSoap_header_Soap" part="header_0"
use="literal" />

</wsdl:input>

<wsdl:output>

<soap:body use="literal" parts="response" />

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="ServiceRootSoap">

<wsdl:port name="ServiceRootSoap" binding="tns:ServiceRootSoap">

<soap:address location="http://<snipped>/wasp/ServiceRoot" />

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

------------------------------- END OF WSDL
file ----------------------------------

"Dan Rogers" <da***@microsoft.com> wrote in message
news:RH**************@cpmsftngxa10.phx.gbl...
Hi Jerome,

There isn't enough of the WSDL Types section in your post to determine what the right value for the namespace should be. If the WSDL is correctly
formed, add-web-reference should do the job. You shouldn't have to be
sending XML fragments - you can work with well formed classes (if you
prefer). If you are creating the XML nodes by hand, you should use
CreateNode instead of CreateElement so you can pass in the right namespace
value. The targetNamespace from the schema in the WSDL types section
should be the value you pass.

I hope this helps,

Dan Rogers
Microsoft Corporation
--------------------
From: "Jerome Cohen" <yo**********@structuredweb.com>
Subject: badly formed XML when calling a web service
Date: Tue, 14 Dec 2004 21:44:16 -0500
Lines: 273
Organization: SW
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Message-ID: <Op**************@TK2MSFTNGP14.phx.gbl>
Newsgroups:
microsoft.public.dotnet.framework.webservices,micr osoft.public.dotnet.framew ork.webservices.enhancements,microsoft.public.webs ervices
NNTP-Posting-Host: 66.45.236.227
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP14 phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices.enha ncements:5156
microsoft.public.webservices:2599
microsoft.public.dotnet.framework.webservices:8101
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

AI am trying to call a third-party web service. this service expects an XML fragment that contains the request plus other parameter. adding the web
reference created the syntax below(reference.vb).

I changed the data type for the structure that contains the XML data from
the default "String" to "xml.xmldocument" to enable easy filling of the
data.

my client code creates an XML document class, fills the data using standard xml dom calls, and then invokes the web service.

the server refuses my call because the XML element below the root element
(customerGeneralInquiryRequests ) contains an empty "xmlns" attribute. How
do I get rid of it? I tried to define PDataXML as a node, explicitly declare the namespace as "nothing" when calling "CreateElement", nothing helps!

attached: samples from the reference file, my code that fills the XML
framgment, the WSDL retrieved from the web serrver, and from the output
trace.

any help will be appreciated!
note: a second question. the process by which the "p0" and "PDataXML"
elements are created in the request body are unclear to me. can anyone
explain or refer to good explanations? thanks!
---- FROM the client code --------------------------
Dim svc As New ServiceRootSoap

<SNIPPED CODE>

Dim aResult As CallServiceResponse

Dim aRequest As New CallService

Dim aRootNode, aDataNode As XmlNode

Dim aXMLDoc As New XmlDocument

aRootNode = aXMLDoc.CreateElement(Nothing, "customerGeneralInquiryRequests", Nothing)

aXMLDoc.AppendChild(aRootNode)

<SNIPPED CODE>
aRequest.PDataXML = aXMLDoc

Try

aResult = svc.CallService(aRequest)

---- END OF from client code ----------------------

---- FROM reference.vb -------------------------------
<System.Web.Services.Protocols.SoapHeaderAttribute ("scsServiceHeader"), _
System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://webservice s.hedberg.comServiceRootSoap#CallService?KExzdGVlb GNhc2Uvc2VydmV"& _
"yL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZpY2U7KUxzdGVlbGNh c2Uvc2VydmVyL2lmYWNlcy9zdH J1Y3Q"& _

"vQ2FsbFNlcnZpY2VSZXNwb25zZTs=",
Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Bare)>
_Public Function
CallService(<System.Xml.Serialization.XmlElementAt tribute([Namespace]:="http ://systinet.com/xsd/SchemaTypes/", IsNullable:=true)> ByVal p0 As
CallService) As
<System.Xml.Serialization.XmlElementAttribute("Cal lServiceResponse_Response" , [Namespace]:="http://systinet.com/xsd/SchemaTypes/", IsNullable:=true)>
CallServiceResponse

Dim results() As Object = Me.Invoke("CallService", New Object() {p0})

Return CType(results(0),CallServiceResponse)

End Function

.........

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://systinet.com /wsdl/steelcase/server/ifaces/struct/")> _

Public Class CallService
'<remarks/>

<System.Xml.Serialization.XmlElementAttribute(IsNu llable:=True)> _

Public PDataXML As Xml.XmlDocument 'string

.....

---- END OF from reference.vb ----------------------------------

---- FROM the output trace ---------------------------------------
<soap:Body wsu:Id="Id-61872b1c-682f-49eb-9c07-bd40aa4b42b1">
<p0 xmlns="http://systinet.com/xsd/SchemaTypes/">
<PDataXML
xmlns="http://systinet.com/wsdl/steelcase/server/ifaces/struct/">
<customerGeneralInquiryRequests xmlns="">
<customerGeneralInquiryRequest>
.......
---- END OF from the output trace ---------------------------------------


---- FROM the WSDL----------------------------------------------
...........
<xsd:complexType name="CallService">

<xsd:annotation>

<xsd:appinfo>

<map:java-type name="steelcase.server.ifaces.struct.CallService" />

</xsd:appinfo>

</xsd:annotation>

<xsd:sequence>

<xsd:element name="PDataXML" nillable="true" type="xsd:string" />

<xsd:element name="PInstructionsXML" nillable="true" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

<xsd:complexType name="CallServiceResponse">

<xsd:annotation>

<xsd:appinfo>

<map:java-type name="steelcase.server.ifaces.struct.CallServiceRe sponse" />
</xsd:appinfo>

</xsd:annotation>

<xsd:sequence>

<xsd:element name="callServiceResult" nillable="true" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

</s:schema>

<s:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://systinet.com/xsd/SchemaTypes/"
xmlns:xns4="http://systinet.com/wsdl/steelcase/server/ifaces/struct/"
elementFormDefault="qualified"
targetNamespace="http://systinet.com/xsd/SchemaTypes/">

<xsd:import
namespace="http://systinet.com/wsdl/steelcase/server/ifaces/struct/" />

<xsd:element name="p0" nillable="true" type="xns4:CallService" />

<xsd:element name="CallServiceResponse_Response" nillable="true"
type="xns4:CallServiceResponse" />

</s:schema>

</wsdl:types>

<wsdl:message name="ServiceRootSoap_CallService_Response_Soap">

<wsdl:part name="response" element="s3:CallServiceResponse_Response" />

</wsdl:message>

<wsdl:message name="ServiceRootSoap_CallService__Request_Soap">

<wsdl:part name="p0" element="s3:p0" />

</wsdl:message>

<wsdl:message name="ServiceRootSoap_header_Soap">

<wsdl:part name="header_0" element="s2:scsServiceHeader" />

</wsdl:message>

<wsdl:message name="runtimeHeaders_0">

<wsdl:part name="header_0" element="s1:instance" />

<wsdl:part name="header_1" element="s0:TxId" />

</wsdl:message>

<wsdl:portType name="ServiceRootSoap">

<wsdl:operation name="CallService" parameterOrder="p0">

<wsdl:input message="tns:ServiceRootSoap_CallService__Request_ Soap" />

<wsdl:output message="tns:ServiceRootSoap_CallService_Response_ Soap" />

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="ServiceRootSoap" type="tns:ServiceRootSoap">

<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />

<wsdl:operation name="CallService">

<map:java-operation name="CallService"
signature="KExzdGVlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ 1Y3QvQ2FsbFNlcnZpY2U7KUxzd GVlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZ pY2VSZXNwb25zZTs="
xmlns:map="http://systinet.com/mapping/" />

<soap:operation
soapAction="http://webservices.hedberg.comServiceRootSoap#CallService ?KExzdG VlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZp Y2U7KUxzdGVlbGNhc2Uvc2Vydm VyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZpY2VSZXNwb25zZTs= " style="document" />

<wsdl:input>

<soap:body use="literal" parts="p0" />

<soap:header message="tns:ServiceRootSoap_header_Soap" part="header_0"
use="literal" />

</wsdl:input>

<wsdl:output>

<soap:body use="literal" parts="response" />

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="ServiceRootSoap">

<wsdl:port name="ServiceRootSoap" binding="tns:ServiceRootSoap">

<soap:address location="http://<deleted>/ServiceRoot" />

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

---------- END OF from the WSDL -----------------------------------------

Nov 23 '05 #3
Hi Jerome,

The relevant schema is this one:
<s:schema
xmlns:tns="http://systinet.com/wsdl/steelcase/server/ifaces/struct/"
xmlns:map="http://systinet.com/mapping/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="http://systinet.com/wsdl/steelcase/server/ifaces/struct/">

<xsd:complexType name="ScsServiceHeader">
<xsd:sequence>
<xsd:element name="callingSystem" nillable="true" type="xsd:string" />
<xsd:element name="requestID" nillable="true" type="xsd:string" />
<xsd:element name="serviceName" nillable="true" type="xsd:string" />
<xsd:element name="serviceVersion" nillable="true" type="xsd:string" />
<xsd:element name="tradingPartnerID" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>

<xsd:element name="scsServiceHeader" nillable="true"
type="tns:ScsServiceHeader" />

<xsd:complexType name="CallService">
<xsd:sequence>
<xsd:element name="PDataXML" nillable="true" type="xsd:string" />
<xsd:element name="PInstructionsXML" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="CallServiceResponse">
<xsd:sequence>
<xsd:element name="callServiceResult" nillable="true" type="xsd:string"
/>
</xsd:sequence>
</xsd:complexType>
</s:schema>

I've removed some of the annotations to make it clearer. Now, here is what
you say the XML that you are manually creating looks like:

<PDataXML xmlns="http://systinet.com/wsdl/steelcase/server/ifaces/struct/">
<customerGeneralInquiryRequests xmlns="">

It really is hard to work from this snippet, since PDataXml should NOT have
children, at least not according to this schema.

So I do think that a) The XML you are sending is not interface compliant.
I'd need to see the SOAP payload you are sending to make sure, but on first
glance, I'd expect to see that customerGeneralInquiryRequest to have some
namespace. As you've created it, it appears to be an un-namespaced child of
PDataXml - but we've already established that the PDataXml element should
not have any child elements.

So the question comes down to: How are you creating this XML, and why have
you chosen to make PDataXml have child elements in the non-namespace?
Since I'm positive you intend to make the XML represent the format expected
by the service, I'd have to say without looking that whatever code you've
created to generate this XML stream is just plain not up to spec.

Why did you decide to change the generated proxy code that add-web
reference created? It likely was workable as generated, and kept you from
having to play with XML.

Regards

Dan
Nov 23 '05 #4

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

Similar topics

0
by: dfgasner | last post by:
I am very new at all of this and am using a book to put together an e-commerce website using VS.NET 2003. I have run into a problem and have looked around the web but with no help. I am getting...
1
by: Gil | last post by:
This is a question involving CORBA but the problem shows up using Sun C++. The problem doesn't occur with Visual C++ 6. I'm using a string in the following form in my CORBA IDL declaration so...
5
by: Paul Reddin | last post by:
Hi, using ROWNUMBER() is affecting the plan of a view very badly... is there a way of writing the following view to ensure rownumber() is done as the last thing done? i.e after the calling...
3
by: Bilal | last post by:
hi all I am facing a little problem. I have a form with a dropdownlist control. I have a button and when i click the form posts back The problem is that in the on button click event i'm calling...
1
by: Eric | last post by:
I created a simple web site in VS 2005 and then copied it underneath the IIS tree and created a virtual directory for it. When I try to access the default.aspx page I get the below error text: ...
0
by: han zhiyang | last post by:
I have two new questions. 1. my exception handling codes works well when I synchronously call a web service,but How can I use it in asynchronously calling? I tried in the same way,but when error...
8
by: Seeker | last post by:
Hello, In using Solaris Pro Compiler to compile Pro*C code. I am getting this error: make: Fatal error in reader: parser_proc_online.mk, line 26: Badly formed macro assignment Based on other...
0
by: jimmyfishbean | last post by:
Hi, I am using ASP.NET (framework 1.1), Windows 2003, IIS 6.0. I have a VB.NET web service client that connects/calls a web service written in ASP.NET (both applications are installed on the...
0
by: JeremyPollack | last post by:
Here's the situation : I have the same ASP.NET 2.0 web application running on both Machine A and Machine B. On both machines, I have Integrated Windows Authentication turned on, and Anonymous...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.