Options

Read received xml webservice

lyotlyot Member Posts: 202
edited 2010-03-17 in NAV Three Tier
I'm sending the following file to webservice in NAV2009 (codeunit I published).
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<soap:Body>
		<CustomerUpdate xmlns="urn:microsoft-dynamics-schemas/codeunit/WebserviceListener">
			<XmlFile>
				<Customer Action="Insert">
					<No.>1</No.>
					<Name>test klant</Name>
					<Search_Name>TEST KLANT</Search_Name>
					<Name_2/>
					<Address>a</Address>
					<Address_2/>
					<City/>
					<Contact/>
					<Phone_No./>
					<Telex_No./>
					<Our_Account_No./>
				</Customer>
				<Customer Action="Insert">
					<No.>2</No.>
					<Name>Nog een klant</Name>
					<Search_Name>NOG EEN KLANT</Search_Name>
					<Name_2/>
					<Address/>
					<Address_2/>
					<City/>
					<Contact/>
					<Phone_No./>
					<Telex_No./>
					<Our_Account_No./>
				</Customer>
			</XmlFile>
		</CustomerUpdate>
	</soap:Body>
</soap:Envelope>

I limited the quantity of customerfields in this example, but in fact all should be send.
Defining every customer field as a receive parameter isn't quite the way to go.
Everything between<XmlFile>...</XmlFile> is in fact the 'payload' of my soap message.
But I don't find a way to process is on the receiving webservice, what kind of datatype should I use for receiving parameter?

Answers

  • Options
    sanojsanoj Member Posts: 19
    Hi,

    You should use a XMLPort as your receiving parameter. Take a look at this http://community.dynamics.com/blogs/nav ... 44436.aspx

    \Jonas
  • Options
    lyotlyot Member Posts: 202
    Thank you very much! :D
  • Options
    lyotlyot Member Posts: 202
    Still got a small question/problem.
    The xmlport on the receiving side will it receive the entire soap xml?
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Body>
          <CustomerUpdate xmlns="urn:microsoft-dynamics-schemas/codeunit/WebserviceListener">
    ...
    

    Or just the 'payload' part.
    <XmlFile>
      <Customer Action="Insert">
                   ...
      </Customer>
    </XmlFile>
    
  • Options
    lyotlyot Member Posts: 202
    sanoj wrote:
    Hi,

    You should use a XMLPort as your receiving parameter. Take a look at this http://community.dynamics.com/blogs/nav ... 44436.aspx

    \Jonas

    Thanx to Wireshark I have been able to capture the structure of send soapmessage
    <?xml version="1.0" encoding="utf-8"?>
    	<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    		<soap:Body>
    			<ImportDim xmlns="urn:microsoft-dynamics-schemas/codeunit/DimensionImport">
    				<dimImport>
    					<Dimension xmlns="urn:microsoft-dynamics-nav/xmlports/DimensionImport">
    						<DimensionCode>AREA</DimensionCode>
    						<Code>HELA</Code>
    						<Name>BA</Name>
    					</Dimension>
    				</dimImport>
    			</ImportDim>
    		</soap:Body>
    	</soap:Envelope>
    
Sign In or Register to comment.