Known issue with Exchange Web service TimeZone

EWS returned datetime value is actaully always UTC timezone. however, then append with server time zone. So let’s say if the email created at 15:00 SGT (+18:00); EWS would return date time as 7:00 EST; since the application server (the EWS client) resides in Australia.

To correctly parse the returned date time value, SimpleDateTimeFormat shoule be used twice.

	static ThreadLocal<SimpleDateFormat> sdT1;
	static ThreadLocal<SimpleDateFormat> sdT2;
	static {
		sdT1 = new ThreadLocal<SimpleDateFormat>(){
			@Override
			protected SimpleDateFormat initialValue() {
				return new SimpleDateFormat("dd/mm/yyyy hh:mm:ss");
			}			
		};
		
		sdT2 = new ThreadLocal<SimpleDateFormat>(){
			@Override
			protected SimpleDateFormat initialValue() {
				return new SimpleDateFormat("dd/mm/yyyy hh:mm:ss z");
			}			
		};
		 //sd = new SimpleDateFormat("dd/mm/yyyy hh:mm:ss");					
		 //sd2 = new SimpleDateFormat("dd/mm/yyyy hh:mm:ss z");
	}

		//synchronized (sdT1.get())
		//{
			String datetime = sdT1.get().format(receipt.getDateTimeReceived());
			
			try {
				exchangeCreatedTime = new BFMDateTime(sdT2.get().parse(datetime+" UTC"));
			} catch (ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}finally{
				
			}
		//}

Wired error using Sharepoint web service for uploading files

even though the WSDL says most element are optional. however, it does throw out various WIRED exceptions, if any of the attribute not provided.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:CopyIntoItems>
         <!--Optional:-->
         <soap:SourceUrl>?</soap:SourceUrl>
         <!--Optional:-->
         <soap:DestinationUrls>
            <!--Zero or more repetitions:-->
            <soap:string>?</soap:string>
         </soap:DestinationUrls>
         <!--Optional:-->
         <soap:Fields>
            <!--Zero or more repetitions:-->
            <soap:FieldInformation Type="?" DisplayName="?" InternalName="?" Id="?" Value="?"/>
         </soap:Fields>
         <!--Optional:-->
         <soap:Stream>cid:266527284695</soap:Stream>
      </soap:CopyIntoItems>
   </soapenv:Body>
</soapenv:Envelope>

1. if Fields –> FieldInformation not provided, ErrorCode=”Unknown” ErrorMessage=”Object reference not set to an instance of an object.”
2. if stream not provided, ErrorCode=”Unknown” ErrorMessage=”Value does not fall within the expected range.”
3. if stream uing cid: xxx, HTTP 400 bad request
4. if sourceUrl not provided, ErrorCode=”Unknown” ErrorMessage=”Value does not fall within the expected range.”
5. if destinationUrls not provided, Exception of type ‘Microsoft.SharePoint.SoapServer.SoapServerException’ was thrown. Object reference not set to an instance of an object

all above exceptions could be due to Sharepoint server configuration, as WSDL does say the element could be optional.

the right request works:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:CopyIntoItems>
         <!--Optional:-->
                  <!--Optional:-->
                  <soap:SourceUrl>test90.txt</soap:SourceUrl>
         <soap:DestinationUrls>
            <!--Zero or more repetitions:-->
            <soap:string>https://xxx/2014/1/28/16/26979799/test90.txt</soap:string>
         </soap:DestinationUrls>

         <!--Optional:-->
         <soap:Fields>
            <!--Zero or more repetitions:-->
            <soap:FieldInformation Type="Text" DisplayName="test40.txt" InternalName="test40.txt" Id="12345678-1234-1234-1234-123456789012" Value="test40.txt"/>
         </soap:Fields>

         <!--Optional:-->
         <soap:Stream>1234546</soap:Stream>

      </soap:CopyIntoItems>
   </soapenv:Body>
</soapenv:Envelope>

And it works fine with Fiddler, Java Client; Fiddler, SoapUI. And it turns out nothing specific configuration needed for Fiddler.

Quick Note for Maven repository settings

1. user name/password is not compulsory for proxy settings

2. for local repository, URL should be like this

</p><p>          &lt;repository&gt;<br />          &lt;id&gt;local&lt;/id&gt;<br />          &lt;url&gt;file:///h:/apps/xp/.m2/repository/&lt;/url&gt;<br />        &lt;/repository&gt;</p><p>

</p><p>&lt;localRepository&gt;H:\apps\xp\.m2\repository&lt;/localRepository&gt;</p><p>

Good to know, OpenSSH on Windows Server as FTP, provide link to share folder on another Windows Machine

http://technet.microsoft.com/en-us/library/cc784499(v=ws.10).aspx

we encountered a wired issue, for a painful time. The windows 2008 machine A, set up as FTP server using OpenSSH. There is one folder on this FTP server, which is actually share folder on another windows Machine B.

Windows team then enabled all permissions almost everywhere, myself (users/everybody group) can read/write into the share folder directly from any machine. The FTP account can SCP/PSCP any file to the share folder onto Machine A. Wired thing is, the FTP account, if connect through SFTP, it can only read/delete/update files into that share folder, but never able to write new files.

the exception encountered, when uploading file is

sftp> put test.txt test4
Uploading test.txt to //xx/dfs/xx/xx/xx/xx/xx/test.txt
Couldn't get handle: Permission denied

 

Then finally windows team found above link,

ShareFolderPermission

and enabled both below Share and NTFS permission.

NTFSPermission

SharePermission