Permalink
Browse files

inboud intgration with CXF

  • Loading branch information...
1 parent cfb1e30 commit 26613845eac91a6649afa0f55e7374d63387cdd8 Barry committed Sep 12, 2011
Showing with 20,889 additions and 7,508 deletions.
  1. +83 −6 SpringXfc/src/main/java/com/barryku/cloud/controller/SforceController.java
  2. +28 −0 SpringXfc/src/main/java/com/barryku/cloud/model/SpringProperties.java
  3. +54 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/AllOrNoneHeader.java
  4. +54 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/AllowFieldTruncationHeader.java
  5. +99 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ApiFault.java
  6. +80 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ApiQueryFault.java
  7. +92 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/AssignmentRuleHeader.java
  8. +92 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/CallOptions.java
  9. +155 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ChildRelationship.java
  10. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ConvertLead.java
  11. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ConvertLeadResponse.java
  12. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Create.java
  13. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/CreateResponse.java
  14. +124 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DataCategory.java
  15. +90 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DataCategoryGroupSobjectTypePair.java
  16. +54 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DebugLevel.java
  17. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DebuggingHeader.java
  18. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DebuggingInfo.java
  19. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Delete.java
  20. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DeleteResponse.java
  21. +116 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DeleteResult.java
  22. +93 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DeletedRecord.java
  23. +165 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeDataCategoryGroupResult.java
  24. +180 −0 ...gXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeDataCategoryGroupStructureResult.java
  25. +88 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeDataCategoryGroupStructures.java
  26. +69 −0 ...c/src/main/java/com/barryku/cloud/sforce/partner/DescribeDataCategoryGroupStructuresResponse.java
  27. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeDataCategoryGroups.java
  28. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeDataCategoryGroupsResponse.java
  29. +34 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeGlobal.java
  30. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeGlobalResponse.java
  31. +115 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeGlobalResult.java
  32. +450 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeGlobalSObjectResult.java
  33. +187 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeLayout.java
  34. +98 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeLayout2.java
  35. +109 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeLayoutButton.java
  36. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeLayoutButtonSection.java
  37. +128 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeLayoutComponent.java
  38. +153 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeLayoutItem.java
  39. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeLayoutResponse.java
  40. +120 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeLayoutResult.java
  41. +88 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeLayoutRow.java
  42. +173 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeLayoutSection.java
  43. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSObject.java
  44. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSObjectResponse.java
  45. +641 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSObjectResult.java
  46. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSObjects.java
  47. +71 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSObjectsResponse.java
  48. +34 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSoftphoneLayout.java
  49. +188 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSoftphoneLayoutCallType.java
  50. +62 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSoftphoneLayoutInfoField.java
  51. +62 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSoftphoneLayoutItem.java
  52. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSoftphoneLayoutResponse.java
  53. +125 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSoftphoneLayoutResult.java
  54. +97 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSoftphoneLayoutSection.java
  55. +118 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeSoftphoneScreenPopOption.java
  56. +193 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeTab.java
  57. +170 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeTabSetResult.java
  58. +34 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeTabs.java
  59. +71 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DescribeTabsResponse.java
  60. +54 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/DisableFeedTrackingHeader.java
  61. +235 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Email.java
  62. +147 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/EmailFileAttachment.java
  63. +92 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/EmailHeader.java
  64. +60 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/EmailPriority.java
  65. +71 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/EmptyRecycleBin.java
  66. +71 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/EmptyRecycleBinResponse.java
  67. +115 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/EmptyRecycleBinResult.java
  68. +125 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Error.java
  69. +214 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ExceptionCode.java
  70. +918 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Field.java
  71. +111 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/FieldType.java
  72. +124 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetDeleted.java
  73. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetDeletedResponse.java
  74. +155 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetDeletedResult.java
  75. +34 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetServerTimestamp.java
  76. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetServerTimestampResponse.java
  77. +65 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetServerTimestampResult.java
  78. +124 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetUpdated.java
  79. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetUpdatedResponse.java
  80. +126 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetUpdatedResult.java
  81. +34 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetUserInfo.java
  82. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetUserInfoResponse.java
  83. +596 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/GetUserInfoResult.java
  84. +32 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidFieldFault.java
  85. +43 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidFieldFault_Exception.java
  86. +32 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidIdFault.java
  87. +43 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidIdFault_Exception.java
  88. +32 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidNewPasswordFault.java
  89. +43 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidNewPasswordFault_Exception.java
  90. +32 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidQueryLocatorFault.java
  91. +43 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidQueryLocatorFault_Exception.java
  92. +32 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidSObjectFault.java
  93. +43 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidSObjectFault_Exception.java
  94. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidateSessions.java
  95. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidateSessionsResponse.java
  96. +86 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/InvalidateSessionsResult.java
  97. +57 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/LayoutComponentType.java
  98. +259 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/LeadConvert.java
  99. +199 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/LeadConvertResult.java
  100. +62 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/LocaleOptions.java
  101. +92 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Login.java
  102. +32 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/LoginFault.java
  103. +43 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/LoginFault_Exception.java
  104. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/LoginResponse.java
  105. +211 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/LoginResult.java
  106. +91 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/LoginScopeHeader.java
  107. +32 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Logout.java
  108. +32 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/LogoutResponse.java
  109. +32 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/MalformedQueryFault.java
  110. +43 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/MalformedQueryFault_Exception.java
  111. +32 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/MalformedSearchFault.java
  112. +43 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/MalformedSearchFault_Exception.java
  113. +158 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/MassEmailMessage.java
  114. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Merge.java
  115. +97 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/MergeRequest.java
  116. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/MergeResponse.java
  117. +179 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/MergeResult.java
  118. +54 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/MruHeader.java
  119. +1,433 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ObjectFactory.java
  120. +100 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/PackageVersion.java
  121. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/PackageVersionHeader.java
  122. +153 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/PicklistEntry.java
  123. +97 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/PicklistForRecordType.java
  124. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Process.java
  125. +102 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ProcessRequest.java
  126. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ProcessResponse.java
  127. +236 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ProcessResult.java
  128. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ProcessSubmitRequest.java
  129. +92 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ProcessWorkitemRequest.java
  130. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Query.java
  131. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/QueryAll.java
  132. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/QueryAllResponse.java
  133. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/QueryMore.java
  134. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/QueryMoreResponse.java
  135. +62 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/QueryOptions.java
  136. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/QueryResponse.java
  137. +135 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/QueryResult.java
  138. +128 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/RecordTypeInfo.java
  139. +191 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/RecordTypeMapping.java
  140. +251 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/RelatedList.java
  141. +146 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/RelatedListColumn.java
  142. +81 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/RelatedListSort.java
  143. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ResetPassword.java
  144. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ResetPasswordResponse.java
  145. +62 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/ResetPasswordResult.java
  146. +126 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Retrieve.java
  147. +71 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/RetrieveResponse.java
  148. +161 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SObject.java
  149. +115 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SaveResult.java
  150. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Search.java
  151. +62 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SearchRecord.java
  152. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SearchResponse.java
  153. +94 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SearchResult.java
  154. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SendEmail.java
  155. +153 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SendEmailError.java
  156. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SendEmailResponse.java
  157. +86 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SendEmailResult.java
  158. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SessionHeader.java
  159. +92 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SetPassword.java
  160. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SetPasswordResponse.java
  161. +30 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SetPasswordResult.java
  162. +76 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SforceService.java
  163. +455 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SingleEmailMessage.java
  164. +405 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Soap.java
  165. +75 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/SoapType.java
  166. +579 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Soap_Soap_Client.java
  167. +364 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/StatusCode.java
  168. +71 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Undelete.java
  169. +71 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/UndeleteResponse.java
  170. +115 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/UndeleteResult.java
  171. +32 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/UnexpectedErrorFault.java
  172. +43 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/UnexpectedErrorFault_Exception.java
  173. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Update.java
  174. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/UpdateResponse.java
  175. +98 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/Upsert.java
  176. +69 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/UpsertResponse.java
  177. +134 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/UpsertResult.java
  178. +64 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/UserTerritoryDeleteHeader.java
  179. +2 −0 SpringXfc/src/main/java/com/barryku/cloud/sforce/partner/package-info.java
  180. +0 −7,500 SpringXfc/src/main/resources/enterprise.xml
  181. +7 −1 SpringXfc/src/main/webapp/WEB-INF/mvc-servlet.xml
  182. +1 −1 SpringXfc/src/main/webapp/WEB-INF/spring-config.xml
  183. +3 −0 SpringXfc/src/main/webapp/WEB-INF/spring.properties
@@ -1,25 +1,102 @@
package com.barryku.cloud.controller;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.jaxb.JAXBDataBinding;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.w3c.dom.Element;
-import com.sforce.soap.partner.*;
-import com.sforce.soap.partner.sobject.*;
-import com.sforce.ws.*;
+import com.barryku.cloud.model.SpringProperties;
+import com.barryku.cloud.sforce.partner.QueryResult;
+import com.barryku.cloud.sforce.partner.SessionHeader;
+import com.barryku.cloud.sforce.partner.SforceService;
+import com.barryku.cloud.sforce.partner.Soap;
+import com.sforce.soap.partner.Connector;
+import com.sforce.soap.partner.PartnerConnection;
+import com.sforce.soap.partner.sobject.SObject;
+import com.sforce.ws.ConnectorConfig;
@Controller
public class SforceController {
+ @Autowired
+ private SpringProperties springProperties;
+
@RequestMapping("/sforcetest")
public void createAccount() throws Exception {
ConnectorConfig config = new ConnectorConfig();
- config.setUsername("mypixo@yahoo.com");
- config.setPassword("MwP8lbh1NsGUYqdbZJH4" + "9KgF9GYiDr0dQcdo7pwlckG8");
+ config.setUsername(springProperties.getUserName());
+ config.setPassword(springProperties.getPassword() + springProperties.getSecurityToken());
PartnerConnection connection = Connector.newConnection(config);
SObject account = new SObject();
account.setType("Book__c");
- account.setField("Name", "It works with cutom objects");
+ account.setField("Name", "It works with cutom objects");
connection.create(new SObject[]{account});
}
+
+ @RequestMapping("/sforcetest2")
+ public void createAccount2() throws Exception {
+ SforceService service = new SforceService();
+ Soap port = service.getSoap();
+
+ com.barryku.cloud.sforce.partner.LoginResult login = port.login(springProperties.getUserName(),
+ springProperties.getPassword() + springProperties.getSecurityToken());
+ String url = login.getServerUrl();
+ String sessionId = login.getSessionId();
+
+ Soap soapPort = setServerUrlAndSessionId(port, url, sessionId);
+ QueryResult result = soapPort.queryAll("SELECT Id, Name, Type__c FROM Book__c");
+ System.out.println("url:" + url);
+ System.out.println("sessionID:" + sessionId);
+ com.barryku.cloud.sforce.partner.SObject newSobj = null;
+ for (com.barryku.cloud.sforce.partner.SObject sobj:result.getRecords()) {
+
+ for (Object o : sobj.getAny()) {
+ Element element = (Element) o;
+ System.out.println(element.getLocalName() + "-----" +
+ (element.getFirstChild()== null ? "nothing here" : element.getFirstChild().getNodeValue()));
+ }
+ newSobj = sobj;
+
+ }
+
+ //set ID to null, so it can be created as new object
+ newSobj.setId(null);
+ newSobj.setType("Book__c");
+ for (Object o:newSobj.getAny()) {
+
+ Element element = (Element) o;
+ if ("Name".equals(element.getLocalName())) {
+ System.out.println("...." + o);
+ element.getFirstChild().setNodeValue("test book " + Math.random());
+ } else if ("Type__c".equals(element.getLocalName())) {
+ System.out.println("...." + o);
+ element.getFirstChild().setNodeValue("Novel");
+ }
+ }
+ List<com.barryku.cloud.sforce.partner.SObject> objs = new ArrayList<com.barryku.cloud.sforce.partner.SObject>();
+ objs.add(newSobj);
+ port.create(objs);
+
+ }
+
+ private Soap setServerUrlAndSessionId(Soap port, String url, String sessionId) throws JAXBException {
+ BindingProvider bp = (BindingProvider) port;
+ bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
+ SessionHeader header = new SessionHeader();
+ header.setSessionId(sessionId);
+ List<Header> headers = new ArrayList<Header>();
+ headers.add(new Header(new QName("urn:partner.soap.sforce.com", "SessionHeader"), header, new JAXBDataBinding(SessionHeader.class)));
+ bp.getRequestContext().put(Header.HEADER_LIST, headers);
+ return (Soap) bp;
+ }
}
@@ -0,0 +1,28 @@
+package com.barryku.cloud.model;
+
+public class SpringProperties {
+ private String userName;
+ private String password;
+ private String securityToken;
+ public String getUserName() {
+ return userName;
+ }
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+ public String getSecurityToken() {
+ System.out.println("security:" + securityToken);
+ return securityToken;
+ }
+ public void setSecurityToken(String securityToken) {
+ this.securityToken = securityToken;
+ }
+
+
+}
@@ -0,0 +1,54 @@
+
+package com.barryku.cloud.sforce.partner;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="allOrNone" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "allOrNone"
+})
+@XmlRootElement(name = "AllOrNoneHeader")
+public class AllOrNoneHeader {
+
+ protected boolean allOrNone;
+
+ /**
+ * Gets the value of the allOrNone property.
+ *
+ */
+ public boolean isAllOrNone() {
+ return allOrNone;
+ }
+
+ /**
+ * Sets the value of the allOrNone property.
+ *
+ */
+ public void setAllOrNone(boolean value) {
+ this.allOrNone = value;
+ }
+
+}
@@ -0,0 +1,54 @@
+
+package com.barryku.cloud.sforce.partner;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="allowFieldTruncation" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "allowFieldTruncation"
+})
+@XmlRootElement(name = "AllowFieldTruncationHeader")
+public class AllowFieldTruncationHeader {
+
+ protected boolean allowFieldTruncation;
+
+ /**
+ * Gets the value of the allowFieldTruncation property.
+ *
+ */
+ public boolean isAllowFieldTruncation() {
+ return allowFieldTruncation;
+ }
+
+ /**
+ * Sets the value of the allowFieldTruncation property.
+ *
+ */
+ public void setAllowFieldTruncation(boolean value) {
+ this.allowFieldTruncation = value;
+ }
+
+}
@@ -0,0 +1,99 @@
+
+package com.barryku.cloud.sforce.partner;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ApiFault complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ApiFault">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="exceptionCode" type="{urn:fault.partner.soap.sforce.com}ExceptionCode"/>
+ * &lt;element name="exceptionMessage" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ApiFault", namespace = "urn:fault.partner.soap.sforce.com", propOrder = {
+ "exceptionCode",
+ "exceptionMessage"
+})
+@XmlSeeAlso({
+ InvalidIdFault.class,
+ UnexpectedErrorFault.class,
+ InvalidQueryLocatorFault.class,
+ LoginFault.class,
+ InvalidNewPasswordFault.class,
+ ApiQueryFault.class
+})
+public class ApiFault {
+
+ @XmlElement(required = true)
+ protected ExceptionCode exceptionCode;
+ @XmlElement(required = true)
+ protected String exceptionMessage;
+
+ /**
+ * Gets the value of the exceptionCode property.
+ *
+ * @return
+ * possible object is
+ * {@link ExceptionCode }
+ *
+ */
+ public ExceptionCode getExceptionCode() {
+ return exceptionCode;
+ }
+
+ /**
+ * Sets the value of the exceptionCode property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ExceptionCode }
+ *
+ */
+ public void setExceptionCode(ExceptionCode value) {
+ this.exceptionCode = value;
+ }
+
+ /**
+ * Gets the value of the exceptionMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getExceptionMessage() {
+ return exceptionMessage;
+ }
+
+ /**
+ * Sets the value of the exceptionMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setExceptionMessage(String value) {
+ this.exceptionMessage = value;
+ }
+
+}
Oops, something went wrong.

0 comments on commit 2661384

Please sign in to comment.