Forum Discussion

dkarunakaran's avatar
dkarunakaran
New Contributor
13 years ago

Avoiding xsi:type attribute from Webservice request parameters

 

We are using basicHTTPBinding to call WCF services. The service method parameters are objects which in terms refer to other objects.

When a webservice request parameters refer to an object, request is getting created with xsi:type referring to the object as namespace.  Example below..

<ns2:ScheduledEvents xsi:type="ns2:ScheduledEvent">

 

Is there a way to suppress creation of xsi:type within parameters?

 

sample code:

 

Set serviceInfo = WebServices.CreateWebServiceInfoFromItem("AService")              

 

  Set asEvent = serviceInfo.TypeFactory.ScheduledEvent

  asEvent.Id = 11

  asEvent.SNo = 101

 

  set asWOObj = serviceInfo.TypeFactory.ScheduledWO

  asWOObj.Id = 11

  asWOObj.AutoscheduledEvents =  asEvent  

  asWOObj.CId = "1011"   

  Set requestObj = ServiceInfo.PrepareRequestObject("IsBookingPossible")

  Set requestObj.OrdersRequest = asWOObj

  Set requestXml = ServiceInfo.PrepareRequest("IsBookingPossible", requestObj)

 

Following is a sample request created from above code.

 

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                <soap:Header>

                                <MY_Token soap:actor="31a996dc" xmlns="http://www.EXAMPLE.com">mytoken</MY_Token>

                </soap:Header>

                <soap:Body xmlns:ns1="http://www.EXAMPLE.com/XYZ/services/2012/07">

                                <ns1:OrdersRequest xmlns:ns2="http://www.EXAMPLE.com/xyz/contracts/2012/07" xsi:type="ns2:AutoScheduled">

                                                <ns2:Id>11</ns2:Id>

                                                <ns2:SNumber>101</ns2:SNumber>

 

                                                <ns2:ScheduledEvents xsi:type="ns2:ScheduledEvent">

                                                                <ns2:Id>1</ns2:Id>

                                                                <ns2:SessionId>0</ns2:SessionId>

 

                                                </ns2:ScheduledEvents>

                                                <ns2:CId>1011</ns2:CId>

                                </ns1:OrdersRequest>

                </soap:Body>

</soap:Envelope>

1 Reply


  • Hi,


     


    I see that you contacted our Support Team with this question. I suggest that you continue investigating it with them. Refer to use with your results.