Showing posts with label biztalk. Show all posts
Showing posts with label biztalk. Show all posts

Create WSDL in Apache obfiz | Create web services in Apache ofbiz | Apache ofbiz web services tutorial.

In my project there is requirement of web services integration with Microsoft BizTalk i.e. Through WSDL
Biztalk will communicate with Apache ofbiz Services.

Following below step to follow for exposed ofbiz service to as web Services

1. Create a Apache ofbiz Services as below
   package org.ofbiz.party.party;

import java.util.Map;

import javolution.util.FastMap;

import org.ofbiz.service.DispatchContext;

public class TestWebService {
   
   
      public static Map<String, Object> testWebSerice(DispatchContext ctx, Map<String, ? extends Object> context) {
         
          Map<String, Object> result = FastMap.newInstance();
        try
        {
          String username=(String) context.get("userName");
         
          if(username.equals("kumud"))
          {
              result.put("returnMsg", "Hi Kumud") ;
          }
          else
          {
              result.put("returnMsg", "You are not kumud") ;
          }
         
          return result;
         
      }
     
      catch(Exception ex)
      {
          ex.fillInStackTrace();
          result.put("returnMsg", "Hi Kumud") ;
          return result;
      }
}
}


2. Register service in services.xml file as below

 <service name="TestWebSerice" engine="java" auth="false"
            location="org.ofbiz.party.party.TestWebService" invoke="testWebSerice"  export="false">
        <description>Test Web Service  by kumud</description>
       
        <attribute name="userName" type="String" mode="IN" optional="false"/>
        <attribute name="returnMsg" type="String" mode="OUT" optional="false"/>
       
    </service>

3. For expose above service as Web Services by making  export="true" in above configuration

   <service name="TestWebSerice" engine="java" auth="false"
            location="org.ofbiz.party.party.TestWebService" invoke="testWebSerice"  export="true">
        <description>Test Web Service  by kumud</description>
       
        <attribute name="userName" type="String" mode="IN" optional="false"/>
        <attribute name="returnMsg" type="String" mode="OUT" optional="false"/>
       
    </service>
   
4. Now start server hit by url http://localhost:8080/webtools/control/SOAPService/TestWebSerice?wsdl in web browser
   there show WSDL file