Home > Back-end >  Ask god to help post deployment to send data to the server to the HTTPS interface why run a after th
Ask god to help post deployment to send data to the server to the HTTPS interface why run a after th

Time:01-23

Post to HTTPS interface to send data to the server at first why running after a run will be submitted to the null pointer


BufferedReader in=null;
The StringBuilder result=new StringBuilder ();
HttpsURLConnection conn=null;
ResourceBundle resource=ResourceBundle. GetBundle (" com/ismp/test ");
Url String key=resource. Get String (" ");
String appId=resource. Get String (" appId ");
String secret=resource. Get String (" secret ");
ServiceOrderCT ct=serviceOrder. GetServiceOrderCT ();
The Product the Product=productInstance. GetProduct ();
String synctime1=df. The format (new Date ());
String synctime=df2. The format (new Date ());
The String be=df. The format (productInstance. GetCreateDate ());
String en=df. The format (productInstance getEndDate ());
Try {
ServiceOrder. (getOrg). The getId ();
OrderInfo OrderInfo=new OrderInfo ();
OrderInfo. SetTimeStamp (synctime);
OrderInfo. SetTransactionID (String. The valueOf (ct. GetId ()));
OrderInfo. SetActionType (String. The valueOf (actiontype));
The UserInfo the UserInfo=new the UserInfo ();
The userInfo. SetAccNbr (productInstance getAccountNumber ());
The userInfo. SetUserId (String. The valueOf (userinst getId ()));
The userInfo. SetLoginName (ct) getUserName ());
The userInfo. SetPassword (PasswordHelper. Encrypt (ct. GetPassword ()));
The userInfo. SetCustId (Long. The valueOf (productInstance. GetOrg (). The getId ()));
The userInfo. SetCustLoginName (ct) getUserName ());
The userInfo. SetCustName (ct) getCustomerName ());
The userInfo. SetRealName (ct) getCustomerName ());
The userInfo. SetSex (" ");
ProdInfo ProdInfo=new ProdInfo ();
ProdInfo. SetCustId (String. The valueOf (serviceOrder. GetOrg (). The getId ()));
ProdInfo. SetProdInstId (Long) the valueOf (productInstance getId ()));
ProdInfo. SetProductId (Integer. The valueOf ((int) product. GetId ()));
ProdInfo. SetProductCode (product, getCode ());
ProdInfo. SetStartDate (be);
ProdInfo. SetEndDate (en);
ProdInfo. SetAttributes (ct. The getProperties ());
The userInfo. SetProdInfo (prodInfo);
OrderInfo. SetUserInfo (the userInfo);
Gson Gson=new GsonBuilder (.) disableHtmlEscaping (). The create ();
The String sign=SecuritySHA1Utils. ShaEncode (gson. ToJson (orderInfo) + "& amp;" + appId + & amp; "" + + secret "& amp;" + synctime1);
System. Out.println (gson toJson (orderInfo) + "& amp;" + appId + & amp; "" + + secret "& amp;" + synctime1);
System. The out. Println (gson. ToJson (orderInfo));
System. The out. Println (sign);
URL the URL=new URL (key);
Conn=(HttpsURLConnection) url. OpenConnection ();
Conn. SetSSLSocketFactory (new TLSSocketConnectionFactory ());
Conn. SetDoInput (true);
Conn. SetDoOutput (true);
conn.setRequestMethod("POST");
//send a POST request must be set to true
Conn. SetDoOutput (true);
Conn. SetDoInput (true);
//sets the connection timeout time and read timeout
Conn. SetConnectTimeout (30000);
Conn. SetReadTimeout (10000);
Conn. SetRequestProperty (" appId ", appId);
Conn. SetRequestProperty (" timestamp ", synctime1);
Conn. SetRequestProperty (" sign ", sign);
Conn. SetRequestProperty (" the content-type ", "application/json");

OutputStreamWriter out=new OutputStreamWriter (conn. GetOutputStream (), "utf-8");
Out. Write (gson. ToJson (orderInfo));
Out. The flush ();
out.close();


Java. Lang. NullPointerException
At sun.net.www.protocol.https.HttpsClient.checkURLSpoofing HttpsClient. Java: (604)
At sun.net.www.protocol.https.HttpsClient.afterConnect HttpsClient. Java: (573)
At sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect AbstractDelegateHttpsURLConnection. Java: (185)
The at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0 HttpURLConnection. Java: (1283)
The at sun.net.www.protocol.http.HttpURLConnection.getOutputStream HttpURLConnection. Java: (1258)
At sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream HttpsURLConnectionImpl. Java: (250)
At com. The ismp. Group. Client. SyncProductNewlh. RestNewlh (SyncProductNewlh. Java: 120)
At com. The ismp. Service. Order. Impl. ServiceOrderService. CallBackSI (ServiceOrderService. Java: 3060)
At com. The ismp. Service. Order. Impl. ServiceOrderService $$$$de2232bb FastClassByCGLIB. Invoke (& lt; Generated>)
At net. Sf. Additional. Proxy. MethodProxy. Invoke (MethodProxy. Java: 149)
The at org. Springframework. Aop. Framework. The Cglib2AopProxy $CglibMethodInvocation. InvokeJoinpoint (700). The Cglib2AopProxy Java:
The at org. Springframework. Aop. Framework. ReflectiveMethodInvocation. Proceed (ReflectiveMethodInvocation. Java: 149)
The at org. Springframework. Transaction. The interceptor. TransactionInterceptor. Invoke (TransactionInterceptor. Java: 106)
The at org. Springframework. Aop. Framework. ReflectiveMethodInvocation. Proceed (ReflectiveMethodInvocation. Java: 171)
The at org. Springframework. Aop. Interceptor. ExposeInvocationInterceptor. Invoke (ExposeInvocationInterceptor. Java: 89)
The at org. Springframework. Aop. Framework. ReflectiveMethodInvocation. Proceed (ReflectiveMethodInvocation. Java: 171)
The at org. Springframework. Aop. Framework. The Cglib2AopProxy $DynamicAdvisedInterceptor. Intercept (635). The Cglib2AopProxy Java:
nullnullnullnullnullnullnullnullnull
  • Related