dotnet web services enhancements:
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.SoapDocumentMethodAttribute("http://webservice
s.hedberg.comServiceRootSoap#CallService?KExzdGVlbGNhc2Uvc2VydmV"& _
"yL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZpY2U7KUxzdGVlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdH
J1Y3Q"& _
"vQ2FsbFNlcnZpY2VSZXNwb25zZTs=",
Use:=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)>
_Public Function
CallService(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http
://systinet.com/xsd/SchemaTypes/", IsNullable:=true)> ByVal p0 As
CallService) As
<System.Xml.Serialization.XmlElementAttribute("CallServiceResponse_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(IsNullable:=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.CallServiceResponse" />
</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="KExzdGVlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZpY2U7KUxzd
GVlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZpY2VSZXNwb25zZTs="
xmlns:map="
http://systinet.com/mapping/" />
<soap:operation
soapAction="
http://webservices.hedberg.comServiceRootSoap#CallService?KExzdG VlbGNhc2Uvc2VydmVyL2lmYWNlcy9zdHJ1Y3QvQ2FsbFNlcnZpY2U7KUxzdGVlbGNhc2Uvc2Vydm
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">