วันพฤหัสบดีที่ 23 ตุลาคม พ.ศ. 2557

WSO2Proxy Axis1 For Provide, Axis2 For Consumer


CheckList

WSDL
SOAPAction
https://www.wsdl-analyzer.com/


WSO2ESB; 

@format is required to specify soap-version.



       name="ABCService"
       transports="https"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   
     
         
     

     
         
     
     
       
                  format="soap11"/>
     

 
   
                              xmlns:tns1="http://www.kiatnakinbank.com/services/abc/data"
                        xmlns:apachesoap="http://xml.apache.org/xml-soap"
                        xmlns:impl="http://www.kiatnakinbank.com/services/abc"
                        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                        xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
                        xmlns:intf="http://www.kiatnakinbank.com/services/abc"
                        targetNamespace="http://www.kiatnakinbank.com/services/abc">
                                elementFormDefault="qualified"
                    targetNamespace="http://www.kiatnakinbank.com/services/abc">
               
               
                 
                     
                       
                     

                 
             
               
                 
                     
                       
                   
                 
             
           
                                elementFormDefault="qualified"
                    targetNamespace="http://www.kiatnakinbank.com/services/abc/data">
               
                 
                     
                 

             
               
                 
                     
                     
                     
                 
             
           
       
         
           
       
         
           
       
         
           
               
               
           
       
         
           
           
               
               
                 
             
               
                 
             
           
       
         
           
               
           
       
     
 
   scenario1
   
   
   



Client, With WS-Policy (UTOverTranspor),
Axis1  I think it's not support.
Axis2, It works fine. with Rampart

  private static Policy loadPolicy(String name) throws Exception {

// ClassLoader loader = ABCAxis2Client.class.getClassLoader();
// InputStream resource = loader.getResourceAsStream(name);

StAXOMBuilder builder = new StAXOMBuilder("C:/Users/apichaic/Downloads/j-jws4/jws04code/plain-policy-client1.xml");
System.out.println(builder.toString());
return PolicyEngine.getPolicy(builder.getDocumentElement());
    }

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {

// ConfigurationContext ctx =
// ConfigurationContextFactory.createConfigurationContextFromFileSystem("path/to/client/repo",
// null);

ABCServiceStub stub = new ABCServiceStub();

if (true) {
   ServiceClient client = stub._getServiceClient();
   Options options = client.getOptions();
   options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(null));
   options.setUserName("admin");
   options.setPassword("admin");
   client.engageModule("rampart");
}

/*
* HTTP-Basic Authentication
*/
if (false) {
   // ServiceClient sc = stub._getServiceClient();
   // Options options = sc.getOptions();
   // HttpTransportProperties.Authenticator auth = new
   // HttpTransportProperties.Authenticator();
   // auth.setPreemptiveAuthentication(true);
   // auth.setUsername("admin");
   // auth.setPassword("admin");
   //
   // List authSchemes = new ArrayList();
   // authSchemes.add(HttpTransportProperties.Authenticator.BASIC);
   // auth.setAuthSchemes(authSchemes);
   // options.setProperty(HTTPConstants.AUTHENTICATE, auth);
   // options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
}

InquiryABC inquiryABC = new InquiryABC();
RequestBean requestBean = new RequestBean();
requestBean.setReferenceId("refId:" + System.currentTimeMillis());
inquiryABC.setRequestBean(requestBean);

InquiryABCResponse response = stub.inquiryABC(inquiryABC);

System.out.println(ToStringBuilder.reflectionToString(response));
System.out.println(ToStringBuilder.reflectionToString(response.getInquiryABCReturn()));

System.out.println(response.getInquiryABCReturn().getStatusCode());
System.out.println(response.getInquiryABCReturn().getResponseId());
System.out.println(response.getInquiryABCReturn().getStatueDescription());
                             


Policy.xml, Copy from wso2proxy wsdl
































































ไม่มีความคิดเห็น:

แสดงความคิดเห็น