cancel
Showing results for 
Search instead for 
Did you mean: 

Issue: 0x80072F0C A certificate is required to complete client authentication

former_member200995
Contributor

Hi experts,

I want to use the procedure in Sql server to read the odata which in the SAP bydesign system.

PS: We are using SQL Server 2008

1.I test the url of odata, the url is: https://my336304.sapbydesign.com/sap/byd/odata/cust/v1/khmaterial/MaterialCollection?$filter=Interna... eq '1001' &$expand=MaterialQuantityConversion&$format=json

It need the username and the password, I using the Weiming.wang and ********

It run ok and the result is below picture.

2.Now I obtain the script in the sql server, the below is the script:

USE [hb]
GO
/****** Object:  StoredProcedure [dbo].[proc_CallWebService_odata]    Script Date: 05/18/2018 08:38:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[proc_CallWebService_odata]
as
begin
    declare @obj int
    declare @url varchar(200)
    declare @response varchar(5000)
    
    DECLARE @hResult int
    DECLARE @source varchar(255), @desc varchar(255)
    
    DECLARE @UserName nvarchar(100)
    DECLARE @Password nvarchar(100)

    SET @UserName = 'weiming.wang'
    SET @Password = '********'
    
    set @url = 'https://my336304.sapbydesign.com/sap/byd/odata/cust/v1/khmaterial/MaterialCollection?$filter=InternalID eq ''1001'' &$expand=MaterialQuantityConversion&$format=json'
    
    exec sp_OACreate 'MSXML2.ServerXMLHttp',@obj out

    EXEC sp_OAMethod @Obj,'open',NULL, 'GET', @URL, false,@Username,@Password
    
    EXEC sp_OAMethod @Obj, 'setRequestHeader', NULL, 'Content-Type', 'application/x-www-form-urlencoded'
    exec sp_OAMethod @obj, 'setRequestHeader', NULL, 'Username','weiming.wang'
    exec sp_OAMethod @obj, 'setRequestHeader', NULL, 'Password','********'
    
    select @url
       
    EXEC @hResult = sp_OAMethod @Obj, send, NULL, ''
    
    IF @hResult <> 0 
    BEGIN
          EXEC sp_OAGetErrorInfo @obj, @source OUT, @desc OUT
          SELECT      hResult = convert(varbinary(4), @hResult), 
                      source = @source, 
                      description = @desc, 
                      FailPoint = 'Create failed2', 
                      MedthodName = 'GET' 
          goto destroy 
          return
    END
    
    exec sp_OAGetProperty @obj,'responseText',@response out
        
    select @response [response]
    
    destroy:  
    exec sp_OADestroy @obj  
end

3.Issue: when I run the procedure, it raise the error “0x80072F0C A certificate is required to complete client authentication”, could anyone help to check the issue, which step I need to adjust?

4.Thanks a lot.

When I call the Bydesign webservice using the sql server, it raise the same issue, I'm crazy.

Best Regards,

Benny Huang

former_member716746
Discoverer
0 Kudos

Good afternoon Benny, I am having the same issue, by any chance, where you able to fix the issue?

Thank you very much in advance

former_member200995
Contributor
0 Kudos

Hi Pablo,

I'm sorry, I didn't finish the test in the end. Please let me know if you have any findings. thanks.

0 Kudos

Hi there,

I'm facing the same issue, do any one able to fix it?

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

knutheusermann
Product and Topic Expert
Product and Topic Expert

Hi Benny,

unfortunately I can't help you with the question about the SQL Server. However, your OData request is working in your browser and hence this is no problem we can solve in ByD. Therefore I think a Microsoft forum would be the better place to get a qualified answer to your question about your sql script.

Best regards,
Knut