Soap Service Authentication

I am testing connecting to the SOAP Web Service via a .NET application and all attempted requests get a 405 Method Not Found response. I think this may be because i am using basic authentication which is no longer an option for the SOAP service?

The guide suggests setting up OAUTH authentication however this is not an option for me since the sage x3 instance is not public facing.

Can anyone confirm if it is the case basic authentication will not work and if there is a way to use OAUTH without making the sage instance public facing?

Parents Reply Children
  • in reply to Carles Homs Ferrer

    Hi ,

    I have an old example (10 years old) in C# based on sales order example (SOH object):

    // XML Header to be included in all xml input strings
            private static string XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    
            // Public name of the web service
            private static string WEB_SERVICE_NAME = "SOH";
    
            public Orders()
            {
                InitializeComponent();
    
                // Initialise connection values
                callContext = new CAdxCallContext();
                webService = new CAdxWebServiceXmlCCService();
                paramKey = new CAdxParamKeyValue[1];
                resultXML = new CAdxResultXml();
    
                callContext.codeLang = "BRI";          // Connection language
                callContext.codeUser = "admin";        // X3 user
                callContext.password = "";             // X3 password
                callContext.poolAlias = "WS_DEMOBRI";  // Connection pool name
            }
    
            /// <summary>
            /// This is called when the Read button is clicked.
            /// The program uses the field values to construct input XML
            /// and calls the read() method.
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void Read_Click(object sender, EventArgs e)
            {
                // Complete call context depending on flags
                if (DisplayTraceFile.Checked)
                    callContext.requestConfig = "adxwss.trace.on=on&adxwss.trace.size=16384&adonix.trace.on=on&adonix.trace.level=3&adonix.trace.size=8";
                else
                    callContext.requestConfig = "adxwss.trace.on=off&adxwss.trace.size=16384&adonix.trace.on=off&adonix.trace.level=3&adonix.trace.size=8";
    
                // Prepare paramKeyValue
                paramKey[0] = new CAdxParamKeyValue();
                paramKey[0].key = "1";  // Other method: paramKey[0].key = "SOHNUM";
                paramKey[0].value = SOHNUM.Text;
                // When more than one field in the object key, complete as follows:
                // paramKey[1] = new CAdxParamKeyValue();
                // paramKey[1].Key = "2";
                // paramKey[1].value = ...
    
                // Call web service
                resultXML = webService.read(callContext, WEB_SERVICE_NAME, paramKey);
    
                displayMessages(resultXML);
    
                if (resultXML.status == 0)
                {
                    Status.Text = "Status: NOT OK";
                }
                else
                {
                    Status.Text = "Status: OK";
                    displayData(resultXML);
                }
    
            }

  • in reply to Bruno Gonzalez

    Hello  ,

    thanks for the answer. In .Net core the class CAdxWebServiceXmlCCService are no accessible:

    The way to reference WSDL is different and I suspect this affects the way I use it.

  • in reply to Carles Homs Ferrer

    I don't know how .Net core works, but I bet it has to do with how the WSDL was declared and the code generated.
    medium.com/.../integrating-with-soap-web-services-in-net-core-adebfad173fb