Salesforce

How Do I Consume a Web Service using Apache Axis2? (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Consume a Web Service using Apache Axis2? (Magic xpa 4.x)

You can consume web services using Apache Axis2 by following these steps:

  1. Select CRR from the Project menu.

  2. Open a new line (F4).

  3. From the Type column, select Apache Axis2.

  4. Zoom (F5).

  5. If a component was not selected, the Apache Axis2 Component box opens.

  6. In this box, enter the service endpoint URL that the web services step calls. For example, http://www.dataaccess.com/webservicesserver/textcasing.wso?WSDL.

  7. If a component was already loaded, its property sheet opens.

  8. After you have defined the web service, you can use it in the same way you use any other Java component. For example,

o Define a Java alias in the CRR. TextCasingStub = com.dataaccess.www.webserviceserver.TextCasingStub

o Write a program as follows:

Object Type

Virtual

textCasingStub(A)

JAVA

TextCasingStub

Virtual

invertStringCaseRequest(B)

JAVA

TextCasingStub.InvertStringCase

Virtual

invertStringCaseResponse(C)

JAVA

TextCasingStub.InvertStringCaseResponse

Update

A

Java.TextCasingStub()

Update

B

Java.TextCasingStub.InvertStringCase()

Evaluate

B.setSAString('My String')

Update

C

A.invertStringCase(B)

Verify

Error

JavaException().toString() Cnd: JavaExceptionOccured()

Verify

C.getInvertStringCaseResult()

o After executing the program, you will see a message box with the result.

Note: The Magic xpa logic demonstrated above basically follows the logic of a native Java program.

import com.dataaccess.www.webservicesserver.TextCasingStub;

public class TestClient

{

public static void main(String[] args) throws Exception

{

try

{

TextCasingStub textCasingStub=new TextCasingStub();

TextCasingStub.InvertStringCase invertStringCaseRequest = new TextCasingStub.InvertStringCase();

invertStringCaseRequest.setSAString("My String");

TextCasingStub.InvertStringCaseResponse invertStringCaseResponse = textCasingStub.invertStringCase(invertStringCaseRequest);

System.out.println(String.format("Response: %s", invertStringCaseResponse.getInvertStringResult()));

}

catch (Exception ex)

{

system.out.println(ex);

}

}

}

See also

How Do I Consume a WCF Web Service?


Reference
Attachment 
Attachment