cancel
Showing results for 
Search instead for 
Did you mean: 

Issues while consuming ByD web service from VB.NET

Former Member
0 Kudos

Hi,

I am integrating our website with ByD, as part of initial integration test I have a piece of code below that tries to get Product information by internal ID. I am new to SAP ByD, we have a ByD plugin "E-commerce Web Shop Integration" already setup and all the WSDL from plugin are referenced in a VB.NET web application. The web service 'QueryServiceProductIn' is referenced under the name space 'SAPByDesignProductService' in the web application. But the code is not returning any service products, can someone please guide me on what I am doing wrong? Any other example in VB.NET will be appreciated.

            Dim product As New SAPByDesignProductService.QueryServiceProductInClient

            product.ClientCredentials.UserName.UserName = "XXXXXXX"

            product.ClientCredentials.UserName.Password = "XXXXXXXX"

            product.Open()

            Dim productMS As New SAPByDesignProductService.ServiceProductByElementsQueryMessage_sync

            productMS.ServiceProductSelectionByElements = New SAPByDesignProductService.ServiceProductByElementsQuerySelectionByElements

            Dim arrProductSelectionById(1) As SAPByDesignProductService.ServiceProductByElementsQuerySelectionByInternalID

            arrProductSelectionById(0) = New SAPByDesignProductService.ServiceProductByElementsQuerySelectionByInternalID

            arrProductSelectionById(0).InclusionExclusionCode = "I"

            arrProductSelectionById(0).IntervalBoundaryTypeCode = "1"

            arrProductSelectionById(0).LowerBoundaryInternalID.Value = "xyz"

            productMS.ServiceProductSelectionByElements.SelectionByInternalID = arrProductSelectionById

            productMS.ProcessingConditions = New SAPByDesignProductService.QueryProcessingConditions

            productMS.ProcessingConditions.QueryHitsMaximumNumberValueSpecified = False

            productMS.ProcessingConditions.QueryHitsUnlimitedIndicator = True

            Dim response As New SAPByDesignProductService.ServiceProductByElementsResponseMessage_sync

            response = product.FindByElements(productMS)

            If Not IsNothing(response.ServiceProduct) Then

                For Each item In response.ServiceProduct

                    Trace.Write("InternalId", item.InternalID.ToString)

                    Trace.Write("Name", item.Description.ToString)

                Next

            Else

                Trace.Write("Not Found")

            End If

           

            product.Close()

Regards,

Ajitpal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ajitpal,

Start by using very broad filters to ensure that you aren't accidentally filtering information out.

Try changing the LowerBoundaryInternalID to "*" (wildcard) and see if any results are returned. If so, then you'll know it has something to do with your filter values.

Also check your Business Communication Monitoring in the ByDesign application to ensure your messages are being received successfully.

Former Member
0 Kudos

Hi Dan,

Thanks for the pointers. I have tried changing the LowerBoundaryInternalID to "*" but the result is same. I am not able to see any log of my request on Business Communications Monitoring. I recon the problem lies in the way I assign value to LowerBoundaryInternalID. I have tried it a few different ways but none work:

1 - LowerBoundaryInternalID.Value = "*"

2 - LowerBoundaryInternalID.Value.Equals("*")

3 - dim pid As SAPService.ProductInternalID

     pid = NEW SAPServoce.ProductInternalID

     pid.value = "*"

     LowerBoundaryInternalID = pid

Former Member
0 Kudos

Ajitpal,

What authentication are you using for the request? If it's username/password, are you using a technical user (from a "Communication System") or a business user? If it's a business user, does the business user have access to the "Product Data" Work Center or "Product and Services Porfolio" Work Center?

Former Member
0 Kudos


I am using a technical user for authentication. The user also has a preferred Application Pool of Web Service.

Former Member
0 Kudos

What exactly is the Response that you get from SAP?

If you need help reading the Actual XML that is being exchanged I recommend using Fiddler to capture the XML...(I have had some issues with the .net Proxy generator sometimes not creating accurate code for use with the SAP Webservices). and it is easier to troubleshoot if you know the exact XML being exchanged.

Are you using a Standard Communication Agreement or Have you created you own?

"Business Communication Log" Will only show Success/Failure) message for certain transactions like 3PL or a few others... However they will show invalid logins under "Rejected Web Service Calls" as well as errors in the following format..


.Web service processing error; more details in the web service error log on provider side (UTC timestamp 20140709193523; Transaction ID 00163E06A20D1EE481F4056D9676094D)

If you are getting a response from SAP that is "Valid" just with no results you will not see anything in the communication logs.

You can also try the leave the the lower product as blank.

here is an example used to read a Material  in vb.net  (very Similar)


    Public Shared Function ReadMaterial(oconnection As Connection, MaterialID As String) As QUERYMATERIALIN.MaterialByElementsResponseMessage_sync

        Dim oQProd As New QUERYMATERIALIN.binding

  

        oQProd.Credentials = oconnection.CREDS

    

        Dim oreadsync As New QUERYMATERIALIN.MaterialByElementsQueryMessage_sync

        oreadsync.MaterialSelectionByElements = New QUERYMATERIALIN.MaterialByElementsQuerySelectionByElements

        Dim MAterial = New QUERYMATERIALIN.MaterialByElementsQuerySelectionByInternalID

        Dim MAterialList = New List(Of QUERYMATERIALIN.MaterialByElementsQuerySelectionByInternalID)

        MAterial.LowerBoundaryInternalID = New QUERYMATERIALIN.ProductInternalID

        MAterial.LowerBoundaryInternalID.Value = MaterialID

        MAterial.IntervalBoundaryTypeCode = 1

        MAterial.InclusionExclusionCode = "I"

        MAterialList.Add(MAterial)

        oreadsync.MaterialSelectionByElements.SelectionByInternalID = MAterialList.ToArray

        oreadsync.ProcessingConditions = New QUERYMATERIALIN.QueryProcessingConditions

        oreadsync.ProcessingConditions.QueryHitsUnlimitedIndicator = True

        Dim ores = oQProd.FindByElements(oreadsync)

        Return ores

    End Function

Former Member
0 Kudos

Thanks William,

Your guidance worked wonders! I started of with testing response via SOAP UI and realised the response was returning 0 products and hence I was not seeing any response on my code. Then I tried Materials query and it returned the expected result.

At least now I know that I am on the right track. Next step is to figure out why am I not able to get any products but Materials is returning everything I required from the product anyway.

Answers (0)