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 -----------------------------------------