Skip to Content

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

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=InternalID 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

01.png (45.3 kB)
02.png (13.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 22 at 06:38 AM

    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

    Add comment
    10|10000 characters needed characters exceeded